{
  "openapi": "3.1.0",
  "info": {
    "title": "AutoTally API",
    "version": "1.0.0",
    "description": "The AutoTally API reads your synced Tally data and queues writes to Tally. Authenticate with a workspace API key as a bearer token. Call it from a server: browsers are not supported."
  },
  "servers": [
    {
      "url": "https://relay.autotally.ai",
      "description": "AutoTally API"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Companies and status",
      "description": "List companies, check sync freshness and see whether Tally is reachable."
    },
    {
      "name": "Masters",
      "description": "Read and write ledgers, stock items, groups, units, godowns and the other Tally masters."
    },
    {
      "name": "Vouchers",
      "description": "Read vouchers, and post, alter or delete them with dry run and idempotency."
    },
    {
      "name": "Write status",
      "description": "Follow a write to Tally, retract a queued one and read an approval bundle."
    },
    {
      "name": "Reports",
      "description": "Trial balance, profit and loss, balance sheet, GST returns, TDS and cost centre reports."
    },
    {
      "name": "Outstandings and analytics",
      "description": "Bill-wise receivables and payables with ageing, plus item and party analytics."
    },
    {
      "name": "Documents",
      "description": "Upload bills and statements, read what was extracted and file them into companies."
    },
    {
      "name": "Rules and playbooks",
      "description": "Read the rules and playbooks that shape postings in your workspace."
    }
  ],
  "paths": {
    "/v1/companies": {
      "get": {
        "operationId": "getCompanies",
        "tags": [
          "Companies and status"
        ],
        "summary": "List companies",
        "description": "Returns every company in the workspace, on every Tally connection. Reads take the company `name`. Writes take its `guid`. The response is a plain array with no paging.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Company"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/statistics": {
      "get": {
        "operationId": "getStatistics",
        "tags": [
          "Companies and status"
        ],
        "summary": "Get record counts",
        "description": "Counts of each kind of master and each voucher type in one company, from the synced copy.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Statistics"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "getStatus",
        "tags": [
          "Companies and status"
        ],
        "summary": "Get sync status",
        "description": "Shows, for each company and each kind of data, when it last changed and when it was last compared with Tally. Use this to tell how fresh your reads are. Connection fields describe your key's Tally connection.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bridgeOnline": {
                      "type": "boolean",
                      "description": "`true` while the browser extension is sending heartbeats, even with Tally shut."
                    },
                    "tallyReachable": {
                      "type": "boolean",
                      "description": "`true` when Tally itself answered recently. This is the one to read."
                    },
                    "boxState": {
                      "type": "string",
                      "enum": [
                        "live",
                        "tally-closed",
                        "offline",
                        "none"
                      ],
                      "description": "Which of the four connection states applies."
                    },
                    "lastSeenAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "Last heartbeat from the browser extension."
                    },
                    "companies": {
                      "type": "array",
                      "description": "Every company in the workspace.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "companyGuid": {
                            "type": "string",
                            "description": "Company GUID."
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Company name."
                          },
                          "entities": {
                            "type": "array",
                            "description": "One entry per kind of data.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "entityType": {
                                  "type": "string",
                                  "enum": [
                                    "Company",
                                    "Ledger",
                                    "Voucher",
                                    "Group",
                                    "CostCategory",
                                    "CostCentre",
                                    "Currency",
                                    "VoucherType",
                                    "Unit",
                                    "StockGroup",
                                    "StockCategory",
                                    "Godown",
                                    "StockItem",
                                    "GstRegistration",
                                    "TdsRate",
                                    "Budget",
                                    "Employee",
                                    "PayHead",
                                    "AttendanceType",
                                    "OutstandingBill",
                                    "MasterStatistics",
                                    "VoucherStatistics",
                                    "LedgerClosing",
                                    "StockOnHand"
                                  ],
                                  "description": "Kind of data."
                                },
                                "lastSyncedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time",
                                  "description": "When rows of this kind last changed here. It stays put when Tally has nothing new."
                                },
                                "rowCount": {
                                  "type": "integer",
                                  "description": "Rows held."
                                },
                                "lastCheckedAt": {
                                  "type": [
                                    "string",
                                    "null"
                                  ],
                                  "format": "date-time",
                                  "description": "When this kind was last compared with Tally. Absent on some kinds."
                                },
                                "upToDate": {
                                  "type": "boolean",
                                  "description": "`true` when that comparison found nothing outstanding."
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/bridges/live": {
      "get": {
        "operationId": "getBridgesLive",
        "tags": [
          "Companies and status"
        ],
        "summary": "Check whether Tally is reachable",
        "description": "Answers one question: can your key's Tally connection reach Tally right now? Reads work either way. Writes wait in the queue until it can.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`ok`: the API answered."
                    },
                    "tallyReachable": {
                      "type": "boolean",
                      "description": "`true` when Tally itself answered recently."
                    },
                    "boxState": {
                      "type": "string",
                      "enum": [
                        "live",
                        "tally-closed",
                        "offline",
                        "none"
                      ],
                      "description": "Which of the four connection states applies."
                    },
                    "connectedBridges": {
                      "type": "integer",
                      "description": "How many of your connections are reachable."
                    },
                    "lastSeenAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "Last heartbeat from the browser extension."
                    },
                    "boxName": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Name of the connection."
                    }
                  },
                  "required": [
                    "status",
                    "tallyReachable"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/health": {
      "get": {
        "operationId": "getHealth",
        "tags": [
          "Companies and status"
        ],
        "summary": "Check the API is up",
        "description": "Needs no key. It says the API is running. It says nothing about your Tally, so use `GET /v1/bridges/live` for that.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "`ok` when the API is up."
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/v1/ledgers": {
      "get": {
        "operationId": "getLedgers",
        "tags": [
          "Masters"
        ],
        "summary": "List ledgers",
        "description": "Returns ledgers ordered by name. This list carries a short set of fields: use `GET /v1/ledgers/{name}` for one ledger's balance and detail. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Ledger name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent group."
                          },
                          "gstin": {
                            "type": "string",
                            "description": "GSTIN."
                          },
                          "creditPeriodDays": {
                            "type": "integer",
                            "description": "Credit period in days."
                          },
                          "panNumber": {
                            "type": "string",
                            "description": "PAN."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postLedgers",
        "tags": [
          "Masters"
        ],
        "summary": "Create a ledger",
        "description": "Creates a ledger. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "ledger": {
                    "$ref": "#/components/schemas/LedgerInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "ledger"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putLedgers",
        "tags": [
          "Masters"
        ],
        "summary": "Update a ledger",
        "description": "Updates a ledger chosen by `name`. Only the fields you send change. To rename, send `newName`. A list you send changes nothing unless you also name it in `replaceLists`, which accepts `mailingDetails`, `addresses`, `gstRegistrationDetails`, `gstDetails`, `hsnDetails`, `paymentDetails` and `contactDetails`. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "ledger": {
                    "$ref": "#/components/schemas/LedgerAlterRequest"
                  }
                },
                "required": [
                  "ledger"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteLedgers",
        "tags": [
          "Masters"
        ],
        "summary": "Delete a ledger",
        "description": "Deletes a ledger, chosen by `name` in the JSON body. Without `commit=true` this is a dry run. The ledger can stay in reads for a while after the write is `applied`.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/ledgers/{name}": {
      "get": {
        "operationId": "getLedgersName",
        "tags": [
          "Masters"
        ],
        "summary": "Get a ledger",
        "description": "Returns one ledger with its closing balance, addresses, contacts and GST detail. URL-encode the name. Past balances are not stored, so `asOf` returns the latest figure with `asOfUnavailable` beside it.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Ledger name, URL-encoded.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "description": "Date, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ledger"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`. `asOf` is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such record, or no company with that name."
          },
          "409": {
            "description": "The name matches more than one record in this company."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/stock-items": {
      "get": {
        "operationId": "getStockItems",
        "tags": [
          "Masters"
        ],
        "summary": "List stock items",
        "description": "Returns stock items ordered by name, with a short set of fields. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only items in this stock group.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Only items in this stock category.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Stock item name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Stock group."
                          },
                          "baseUnit": {
                            "type": "string",
                            "description": "Base unit."
                          },
                          "category": {
                            "type": "string",
                            "description": "Stock category."
                          },
                          "hsnCode": {
                            "type": "string",
                            "description": "HSN or SAC code."
                          },
                          "gstRate": {
                            "type": "number",
                            "description": "GST rate percentage."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postStockItems",
        "tags": [
          "Masters"
        ],
        "summary": "Create a stock item",
        "description": "Creates a stock item. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "stockItem": {
                    "$ref": "#/components/schemas/StockItemInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "stockItem"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putStockItems",
        "tags": [
          "Masters"
        ],
        "summary": "Update a stock item",
        "description": "Updates a stock item chosen by `name`. Only the fields you send change. To rename, send `newName`. A list you send changes nothing unless you also name it in `replaceLists`, which accepts `gstDetails`, `hsnDetails`, `openingBatchAllocations` and `components`. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "stockItem": {
                    "$ref": "#/components/schemas/StockItemAlterRequest"
                  }
                },
                "required": [
                  "stockItem"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteStockItems",
        "tags": [
          "Masters"
        ],
        "summary": "Delete a stock item",
        "description": "Deletes a stock item, chosen by `name` in the JSON body. Without `commit=true` this is a dry run. The stock item can stay in reads for a while after the write is `applied`.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/stock-items/{name}": {
      "get": {
        "operationId": "getStockItemsName",
        "tags": [
          "Masters"
        ],
        "summary": "Get a stock item",
        "description": "Returns one stock item with its opening stock, GST detail and bill of materials. URL-encode the name.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Stock item name, URL-encoded.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StockItem"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such record, or no company with that name."
          },
          "409": {
            "description": "The name matches more than one record in this company."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/groups": {
      "get": {
        "operationId": "getGroups",
        "tags": [
          "Masters"
        ],
        "summary": "List account groups",
        "description": "Returns account groups ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only records whose parent is this name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Group name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent group."
                          },
                          "isRevenue": {
                            "type": "boolean",
                            "description": "`true` for a revenue group."
                          },
                          "reservedName": {
                            "type": "string",
                            "description": "Tally's fixed name for its built-in groups. It survives a rename, so classify on this, not on `name`."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postGroups",
        "tags": [
          "Masters"
        ],
        "summary": "Create a group",
        "description": "Creates an account group. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "group": {
                    "$ref": "#/components/schemas/GroupInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "group"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putGroups",
        "tags": [
          "Masters"
        ],
        "summary": "Update a group",
        "description": "Updates a group chosen by `name`. Only the fields you send change. To rename, send `newName`. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "group": {
                    "$ref": "#/components/schemas/GroupAlterRequest"
                  }
                },
                "required": [
                  "group"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteGroups",
        "tags": [
          "Masters"
        ],
        "summary": "Delete a group",
        "description": "Deletes a group, chosen by `name` in the JSON body. Without `commit=true` this is a dry run. The group can stay in reads for a while after the write is `applied`.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/units": {
      "get": {
        "operationId": "getUnits",
        "tags": [
          "Masters"
        ],
        "summary": "List units",
        "description": "Returns units of measure ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Unit symbol name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "formalName": {
                            "type": "string",
                            "description": "Formal name."
                          },
                          "baseUnit": {
                            "type": "string",
                            "description": "Base unit of a compound unit."
                          },
                          "isSimpleUnit": {
                            "type": "boolean",
                            "description": "`true` for a simple unit."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postUnits",
        "tags": [
          "Masters"
        ],
        "summary": "Create a unit",
        "description": "Creates a unit of measure. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "unit": {
                    "$ref": "#/components/schemas/UnitInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "unit"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putUnits",
        "tags": [
          "Masters"
        ],
        "summary": "Update a unit",
        "description": "Updates a unit chosen by `name`. A unit cannot be renamed: `newName` is refused. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "unit": {
                    "$ref": "#/components/schemas/UnitAlterRequest"
                  }
                },
                "required": [
                  "unit"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteUnits",
        "tags": [
          "Masters"
        ],
        "summary": "Delete a unit",
        "description": "Deletes a unit, chosen by `name` in the JSON body. Without `commit=true` this is a dry run. The unit can stay in reads for a while after the write is `applied`.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/godowns": {
      "get": {
        "operationId": "getGodowns",
        "tags": [
          "Masters"
        ],
        "summary": "List godowns",
        "description": "Returns godowns ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Godown name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postGodowns",
        "tags": [
          "Masters"
        ],
        "summary": "Create a godown",
        "description": "Creates a godown. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "godown": {
                    "$ref": "#/components/schemas/GodownInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "godown"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putGodowns",
        "tags": [
          "Masters"
        ],
        "summary": "Update a godown",
        "description": "Renames a godown or changes its alias. It is chosen by `name`. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "godown": {
                    "$ref": "#/components/schemas/GodownAlterRequest"
                  }
                },
                "required": [
                  "godown"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteGodowns",
        "tags": [
          "Masters"
        ],
        "summary": "Delete a godown",
        "description": "Deletes a godown, chosen by `name` in the JSON body. Without `commit=true` this is a dry run. The godown can stay in reads for a while after the write is `applied`.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. `name` matches no record in this company. `name` matches several records. `candidates[]` lists them. This kind of record has not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/cost-centres": {
      "get": {
        "operationId": "getCostCentres",
        "tags": [
          "Masters"
        ],
        "summary": "List cost centres",
        "description": "Returns cost centres ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only records whose parent is this name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Only cost centres in this category.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Cost centre name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent cost centre."
                          },
                          "category": {
                            "type": "string",
                            "description": "Cost category."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postCostCentres",
        "tags": [
          "Masters"
        ],
        "summary": "Create a cost centre",
        "description": "Creates a cost centre. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "costCentre": {
                    "$ref": "#/components/schemas/CostCentreInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "costCentre"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/cost-categories": {
      "get": {
        "operationId": "getCostCategories",
        "tags": [
          "Masters"
        ],
        "summary": "List cost categories",
        "description": "Returns cost categories ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Cost category name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "allocateRevenue": {
                            "type": "boolean",
                            "description": "Allocates revenue items."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postCostCategories",
        "tags": [
          "Masters"
        ],
        "summary": "Create a cost category",
        "description": "Creates a cost category. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "costCategory": {
                    "$ref": "#/components/schemas/CostCategoryInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "costCategory"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/currencies": {
      "get": {
        "operationId": "getCurrencies",
        "tags": [
          "Masters"
        ],
        "summary": "List currencies",
        "description": "Returns currencies. `name` is the symbol. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Currency symbol."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "formalName": {
                            "type": "string",
                            "description": "Currency name."
                          },
                          "decimalPlaces": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Decimal places."
                          },
                          "decimalPlacesForPrinting": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Decimal places when printed."
                          },
                          "amountInWords": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Word for the main unit."
                          },
                          "decimalAmountInWords": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Word for the fractional unit."
                          },
                          "isoCurrencyCode": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "ISO currency code."
                          },
                          "rates": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "description": "Exchange rates.",
                            "items": {
                              "$ref": "#/components/schemas/CurrencyRate"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postCurrencies",
        "tags": [
          "Masters"
        ],
        "summary": "Create a currency",
        "description": "Creates a currency. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "currency": {
                    "$ref": "#/components/schemas/CurrencyInput",
                    "description": "Currency."
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "currency"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/voucher-types": {
      "get": {
        "operationId": "getVoucherTypes",
        "tags": [
          "Masters"
        ],
        "summary": "List voucher types",
        "description": "Returns voucher types ordered by name. Read `numberingMethod` to learn whether you should send `voucherNumber`. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only records whose parent is this name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Voucher type name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "The standard type it derives from."
                          },
                          "numberingMethod": {
                            "type": "string",
                            "description": "How this type numbers vouchers."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/stock-groups": {
      "get": {
        "operationId": "getStockGroups",
        "tags": [
          "Masters"
        ],
        "summary": "List stock groups",
        "description": "Returns stock groups ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only records whose parent is this name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Stock group name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent stock group."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postStockGroups",
        "tags": [
          "Masters"
        ],
        "summary": "Create a stock group",
        "description": "Creates a stock group, optionally with its own GST rate and HSN for the items under it to inherit. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "stockGroup": {
                    "$ref": "#/components/schemas/StockGroupInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "stockGroup"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/stock-categories": {
      "get": {
        "operationId": "getStockCategories",
        "tags": [
          "Masters"
        ],
        "summary": "List stock categories",
        "description": "Returns stock categories ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parent",
            "in": "query",
            "required": false,
            "description": "Only records whose parent is this name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Stock category name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent stock category."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/gst-registrations": {
      "get": {
        "operationId": "getGstRegistrations",
        "tags": [
          "Masters"
        ],
        "summary": "List GST registrations",
        "description": "Returns the company's own GST registrations. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Registration name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "gstin": {
                            "type": "string",
                            "description": "GSTIN."
                          },
                          "stateName": {
                            "type": "string",
                            "description": "State."
                          },
                          "priorStateName": {
                            "type": "string",
                            "description": "Earlier state."
                          },
                          "ewayApplicableType": {
                            "type": "string",
                            "description": "E-way bill applicability."
                          },
                          "gstUserName": {
                            "type": "string",
                            "description": "GST portal user name."
                          },
                          "esignMethod": {
                            "type": "string",
                            "description": "E-sign method."
                          },
                          "isOtherTerritoryAssessee": {
                            "type": "boolean",
                            "description": "Other territory assessee."
                          },
                          "isEwayBillApplicable": {
                            "type": "boolean",
                            "description": "E-way bills apply."
                          },
                          "isEwayBillApplicableForIntra": {
                            "type": "boolean",
                            "description": "E-way bills apply within the state."
                          },
                          "registrationDetails": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "description": "Registration history, dated.",
                            "items": {
                              "$ref": "#/components/schemas/GstRegistrationDetail"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/tds-rates": {
      "get": {
        "operationId": "getTdsRates",
        "tags": [
          "Masters"
        ],
        "summary": "List TDS and TCS rates",
        "description": "Returns TDS and TCS rates. Use `name` as `natureOfPayment` on a voucher line. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Rate name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "isForTcs": {
                            "type": "boolean",
                            "description": "`true` for TCS, `false` for TDS."
                          },
                          "tdsRateSection": {
                            "type": "string",
                            "description": "Section."
                          },
                          "tdsRateChallanCode": {
                            "type": "string",
                            "description": "Challan code."
                          },
                          "sectionName": {
                            "type": "string",
                            "description": "Section name."
                          },
                          "tdsRemittanceCode": {
                            "type": "string",
                            "description": "Remittance code."
                          },
                          "singleBillLimit": {
                            "type": "number",
                            "description": "Single bill limit."
                          },
                          "categoryDetails": {
                            "type": [
                              "array",
                              "null"
                            ],
                            "description": "Rates by category.",
                            "items": {
                              "$ref": "#/components/schemas/TdsCategoryDetail"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/budgets": {
      "get": {
        "operationId": "getBudgets",
        "tags": [
          "Masters"
        ],
        "summary": "List budgets",
        "description": "Returns budgets. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Budget name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "isScenario": {
                            "type": "boolean",
                            "description": "Always `false` here."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent budget."
                          },
                          "narration": {
                            "type": "string",
                            "description": "Notes."
                          },
                          "activeFrom": {
                            "type": "string",
                            "description": "Start date."
                          },
                          "activeTo": {
                            "type": "string",
                            "description": "End date."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/scenarios": {
      "get": {
        "operationId": "getScenarios",
        "tags": [
          "Masters"
        ],
        "summary": "List scenarios",
        "description": "Returns scenarios. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Scenario name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "isScenario": {
                            "type": "boolean",
                            "description": "Always `true` here."
                          },
                          "useActuals": {
                            "type": "boolean",
                            "description": "Includes actual vouchers."
                          },
                          "excludeForex": {
                            "type": "boolean",
                            "description": "Excludes forex vouchers."
                          },
                          "excludeTracking": {
                            "type": "boolean",
                            "description": "Excludes tracking vouchers."
                          },
                          "asOriginal": {
                            "type": "boolean",
                            "description": "Treated as original."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/employees": {
      "get": {
        "operationId": "getEmployees",
        "tags": [
          "Masters"
        ],
        "summary": "List employees",
        "description": "Returns employees ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Employee name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Employee group."
                          },
                          "category": {
                            "type": "string",
                            "description": "Cost category."
                          },
                          "dateOfBirth": {
                            "type": "string",
                            "description": "Date of birth."
                          },
                          "dateOfJoin": {
                            "type": "string",
                            "description": "Date of joining."
                          },
                          "gender": {
                            "type": "string",
                            "description": "Gender."
                          },
                          "bloodGroup": {
                            "type": "string",
                            "description": "Blood group."
                          },
                          "designation": {
                            "type": "string",
                            "description": "Designation."
                          },
                          "function": {
                            "type": "string",
                            "description": "Function."
                          },
                          "location": {
                            "type": "string",
                            "description": "Location."
                          },
                          "emailId": {
                            "type": "string",
                            "description": "Email address."
                          },
                          "contactNumbers": {
                            "type": "string",
                            "description": "Contact numbers."
                          },
                          "panNumber": {
                            "type": "string",
                            "description": "PAN."
                          },
                          "aadharNumber": {
                            "type": "string",
                            "description": "Aadhaar number."
                          },
                          "uanNumber": {
                            "type": "string",
                            "description": "UAN."
                          },
                          "pfAccountNumber": {
                            "type": "string",
                            "description": "PF account number."
                          },
                          "esiNumber": {
                            "type": "string",
                            "description": "ESI number."
                          },
                          "bankAccountNumber": {
                            "type": "string",
                            "description": "Bank account number."
                          },
                          "ifsCode": {
                            "type": "string",
                            "description": "IFSC."
                          },
                          "fatherName": {
                            "type": "string",
                            "description": "Father's name."
                          },
                          "spouseName": {
                            "type": "string",
                            "description": "Spouse's name."
                          },
                          "empDisplayName": {
                            "type": "string",
                            "description": "Display name."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postEmployees",
        "tags": [
          "Masters"
        ],
        "summary": "Create an employee",
        "description": "Creates an employee. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "employee": {
                    "$ref": "#/components/schemas/EmployeeInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "employee"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/employee-groups": {
      "get": {
        "operationId": "getEmployeeGroups",
        "tags": [
          "Masters"
        ],
        "summary": "List employee groups",
        "description": "Returns employee groups ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Group name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent group."
                          },
                          "category": {
                            "type": "string",
                            "description": "Cost category."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postEmployeeGroups",
        "tags": [
          "Masters"
        ],
        "summary": "Create an employee group",
        "description": "Creates an employee group. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "employeeGroup": {
                    "$ref": "#/components/schemas/EmployeeGroupInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "employeeGroup"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/pay-heads": {
      "get": {
        "operationId": "getPayHeads",
        "tags": [
          "Masters"
        ],
        "summary": "List pay heads",
        "description": "Returns pay heads ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Pay head name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent group."
                          },
                          "payType": {
                            "type": "string",
                            "description": "Pay type."
                          },
                          "payslipName": {
                            "type": "string",
                            "description": "Name on the payslip."
                          },
                          "calculationType": {
                            "type": "string",
                            "description": "Calculation type."
                          },
                          "calculationPeriod": {
                            "type": "string",
                            "description": "Calculation period."
                          },
                          "computationType": {
                            "type": "string",
                            "description": "Computation type."
                          },
                          "roundingMethod": {
                            "type": "string",
                            "description": "Rounding method."
                          },
                          "attendanceType": {
                            "type": "string",
                            "description": "Attendance type."
                          },
                          "leaveType": {
                            "type": "string",
                            "description": "Leave type."
                          },
                          "payStatType": {
                            "type": "string",
                            "description": "Statutory type."
                          },
                          "showInPayslip": {
                            "type": "boolean",
                            "description": "Shown on the payslip."
                          },
                          "userDefinedCalendarType": {
                            "type": "string",
                            "description": "Calendar type."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postPayHeads",
        "tags": [
          "Masters"
        ],
        "summary": "Create a pay head",
        "description": "Creates a pay head. `calculationType` is required. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "payHead": {
                    "$ref": "#/components/schemas/PayHeadInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "payHead"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/attendance-types": {
      "get": {
        "operationId": "getAttendanceTypes",
        "tags": [
          "Masters"
        ],
        "summary": "List attendance types",
        "description": "Returns attendance types ordered by name. Answers from the synced copy, so it works when Tally is closed.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Text to find in the name, not case-sensitive.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Attendance type name."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID."
                          },
                          "parent": {
                            "type": "string",
                            "description": "Parent attendance type."
                          },
                          "attendanceProductionType": {
                            "type": "string",
                            "description": "Kind of type."
                          },
                          "baseUnits": {
                            "type": "string",
                            "description": "Unit of attendance."
                          },
                          "attendancePeriod": {
                            "type": "string",
                            "description": "Period."
                          },
                          "displayName": {
                            "type": "string",
                            "description": "Display name."
                          },
                          "asOriginal": {
                            "type": "boolean",
                            "description": "Treated as original."
                          },
                          "showInReport": {
                            "type": "boolean",
                            "description": "Shown in reports."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postAttendanceTypes",
        "tags": [
          "Masters"
        ],
        "summary": "Create an attendance type",
        "description": "Creates an attendance type. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "attendanceType": {
                    "$ref": "#/components/schemas/AttendanceTypeInput"
                  },
                  "acknowledge": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "similar-name"
                      ]
                    }
                  }
                },
                "required": [
                  "attendanceType"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. A record with this or a very similar name exists. `candidates[]` lists them. To create it anyway, send `acknowledge: [\"similar-name\"]`. A field that names another record found no match. `field` says which. A field that names another record matched several. `field` and `candidates[]` say which. The records this field refers to have not synced yet. Try again later."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/units-of-attendance": {
      "post": {
        "operationId": "postUnitsOfAttendance",
        "tags": [
          "Masters"
        ],
        "summary": "Create a unit of attendance",
        "description": "Creates a unit for attendance types. It appears in `GET /v1/units`. Without `commit=true` this is a dry run. Send `Idempotency-Key` on every call. The dry run checks the payload shape only: it does not look the names up in your company, so a green dry run can still get a 409 on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID, from `GET /v1/companies`. Required to commit."
                  },
                  "unitOfAttendance": {
                    "$ref": "#/components/schemas/UnitOfAttendanceInput"
                  }
                },
                "required": [
                  "unitOfAttendance"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/vouchers": {
      "get": {
        "operationId": "getVouchers",
        "tags": [
          "Vouchers"
        ],
        "summary": "List vouchers",
        "description": "Returns voucher headers ordered by date and number. Lists carry no ledger lines: read one voucher for those. `from` and `to` filter the voucher date, not when it changed, so a back-dated edit does not show up in a recent window.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Earliest voucher date, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Latest voucher date, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "voucherType",
            "in": "query",
            "required": false,
            "description": "Only this voucher type.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "einvoiced",
            "in": "query",
            "required": false,
            "description": "Set to `true` for vouchers with an e-invoice. Any other value is ignored.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "eway",
            "in": "query",
            "required": false,
            "description": "Set to `true` for vouchers with an e-way bill. Any other value is ignored.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "cancelled",
            "in": "query",
            "required": false,
            "description": "Set to `true` for cancelled vouchers. Any other value is ignored.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "integer",
                      "description": "This page number."
                    },
                    "pageSize": {
                      "type": "integer",
                      "description": "Page size actually used."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total rows across all pages."
                    },
                    "items": {
                      "type": "array",
                      "description": "The rows.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "voucherNumber": {
                            "type": "string",
                            "description": "Voucher number."
                          },
                          "guid": {
                            "type": "string",
                            "description": "Tally GUID. Use it to read the voucher."
                          },
                          "date": {
                            "type": "string",
                            "format": "date",
                            "description": "Voucher date."
                          },
                          "voucherType": {
                            "type": "string",
                            "description": "Voucher type."
                          },
                          "partyName": {
                            "type": "string",
                            "description": "Party."
                          },
                          "narration": {
                            "type": "string",
                            "description": "Narration."
                          },
                          "amount": {
                            "type": "number",
                            "description": "Voucher amount. May arrive as a string, so parse it."
                          },
                          "reference": {
                            "type": "string",
                            "description": "Reference."
                          },
                          "irn": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "E-invoice IRN."
                          },
                          "ewayBillNo": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "E-way bill number."
                          },
                          "isCancelled": {
                            "type": [
                              "boolean",
                              "null"
                            ],
                            "description": "`true` if cancelled."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postVouchers",
        "tags": [
          "Vouchers"
        ],
        "summary": "Post a voucher",
        "description": "Validates a voucher, and with `commit=true` queues it for Tally. A dry run with `companyGuid` looks up every name, checks the arithmetic and previews the number. It is free and stores nothing. A dry run can pass and the commit still be refused: the checks on duplicate bills and posting limits are reported on a dry run and enforced on commit.",
        "parameters": [
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company to post into, from `GET /v1/companies`. Required to commit. Without it a dry run checks arithmetic only."
                  },
                  "voucher": {
                    "$ref": "#/components/schemas/VoucherInput",
                    "description": "The voucher."
                  },
                  "acknowledge": {
                    "type": "array",
                    "description": "Refusals to waive, by code, after a `gate_blocked` response. A waived voucher always waits for a person to approve it.",
                    "items": {
                      "type": "string",
                      "enum": [
                        "expense-equals-party",
                        "over-threshold",
                        "duplicate-bill"
                      ]
                    }
                  },
                  "documentIds": {
                    "type": "array",
                    "maxItems": 20,
                    "description": "Documents this entry was made from, up to 20. Checked on commit only.",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "required": [
                  "voucher"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoucherDryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why. On a commit refused because your company's Tally settings rule the voucher out, `findings[]` has the details. Nothing can waive that: fix the voucher."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. On commit, a name in the voucher matched nothing. `issues[]` lists them. On a dry run the same problem is a 400 `invalid_voucher`. On commit, a name in the voucher matched several records. On commit, the records this voucher names have not synced yet."
          },
          "422": {
            "description": "A posting check refused it: `duplicate-bill`, `over-threshold` or `expense-equals-party`. `gates[]` has the details. No `message` field on this one. A value in `documentIds` is not in this workspace. A document in `documentIds` already has an entry in this company."
          },
          "503": {
            "description": "The posting checks could not run. Nothing was queued. Retry. A voucher number could not be allocated. Nothing was queued. Retry. The documents could not be read. Nothing was queued. Retry."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/vouchers/{guid}": {
      "get": {
        "operationId": "getVouchersGuid",
        "tags": [
          "Vouchers"
        ],
        "summary": "Get a voucher",
        "description": "Returns one voucher with its ledger lines and stock lines. After a write, this is how you confirm it reached Tally. Send `company` when the workspace has several companies.",
        "parameters": [
          {
            "name": "guid",
            "in": "path",
            "required": true,
            "description": "Voucher GUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Voucher"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such record, or no company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "operationId": "patchVouchersGuid",
        "tags": [
          "Vouchers"
        ],
        "summary": "Replace a voucher",
        "description": "Replaces a posted voucher. This is a full replacement: the body becomes the voucher, and any line you leave out is dropped. Read the voucher first. Posting checks are not run on a replacement. Send `voucherNumber` if the voucher type needs one, as it is not allocated here.",
        "parameters": [
          {
            "name": "guid",
            "in": "path",
            "required": true,
            "description": "GUID of the voucher to replace.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company the voucher belongs to. Required to commit."
                  },
                  "voucher": {
                    "$ref": "#/components/schemas/VoucherInput",
                    "description": "The complete replacement voucher."
                  }
                },
                "required": [
                  "voucher"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoucherDryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why. On a commit refused because your company's Tally settings rule the voucher out, `findings[]` has the details. Nothing can waive that: fix the voucher."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write. On commit, a name in the voucher matched nothing. On commit, a name in the voucher matched several records. On commit, the records this voucher names have not synced yet."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteVouchersGuid",
        "tags": [
          "Vouchers"
        ],
        "summary": "Delete a voucher",
        "description": "Deletes a voucher. A dry run checks the GUID's shape only, not that the voucher exists. Pass `companyGuid` in the query and send no body: a `content-type: application/json` header with an empty body is refused with 400.",
        "parameters": [
          {
            "name": "guid",
            "in": "path",
            "required": true,
            "description": "GUID of the voucher to delete.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "commit",
            "in": "query",
            "required": false,
            "description": "Set to `true` to queue the write. Without it the call is a dry run and changes nothing.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "companyGuid",
            "in": "query",
            "required": false,
            "description": "Company GUID. Required to commit.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "One key per logical write. Reuse it on a retry. Required even on a dry run.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dry run passed. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DryRunResult"
                }
              }
            }
          },
          "202": {
            "description": "Queued. Poll `GET /v1/intents/{id}`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteAccepted"
                }
              }
            }
          },
          "400": {
            "description": "`Idempotency-Key` is missing, or `companyGuid` is missing on a commit. The payload failed validation. `messages[]` says why."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "Committing needs a paid seat. Nothing was queued."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "409": {
            "description": "This `Idempotency-Key` was already used for a different write."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/intents/{id}": {
      "get": {
        "operationId": "getIntentsId",
        "tags": [
          "Write status"
        ],
        "summary": "Get a write's status",
        "description": "Returns where a write has got to. `pending` covers both waiting for approval and waiting for Tally, and this call cannot tell you which. `applied` means Tally accepted the import, not that the record is proven. Confirmation is `resultGuid` non-null, then `GET /v1/vouchers/{guid}`. For masters, read the record back by name.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `intentId` from the commit.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntentStatus"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked. The body has `error` only."
          },
          "404": {
            "description": "No such write in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/intents/{id}/supersede": {
      "post": {
        "operationId": "postIntentsIdSupersede",
        "tags": [
          "Write status"
        ],
        "summary": "Retract a queued write",
        "description": "Withdraws a write that is still pending and has not been approved. Answers 200 either way, so read `superseded`. The key needs writes allowed.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `intentId` from the commit.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "description": "Why, recorded with the write. Cut to 200 characters."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The outcome. `superseded` says whether it was retracted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "intentId": {
                      "type": "string",
                      "description": "The write."
                    },
                    "superseded": {
                      "type": "boolean",
                      "description": "`true` if it was retracted."
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "claimed",
                        "submitted",
                        "applied",
                        "failed",
                        "rejected"
                      ],
                      "description": "Its state now."
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "already-applied",
                        "approved-and-in-flight",
                        "failed",
                        "already-withdrawn"
                      ],
                      "description": "Why it could not be retracted. Present when `superseded` is `false`."
                    },
                    "voucherNumber": {
                      "type": "string",
                      "description": "Present for `already-applied` once known. For display only."
                    },
                    "masterId": {
                      "type": "integer",
                      "description": "Present for `already-applied`: Tally's numeric id for the voucher."
                    }
                  },
                  "required": [
                    "intentId",
                    "superseded",
                    "state"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "403": {
            "description": "The key does not allow writes."
          },
          "404": {
            "description": "No such write in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/bundles/{id}": {
      "get": {
        "operationId": "getBundlesId",
        "tags": [
          "Write status"
        ],
        "summary": "Get an approval bundle",
        "description": "A bundle groups the writes proposed from one document, in the order they apply. Read it after an upload returns a `bundleId`. A key can read a bundle, not approve it.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `bundleId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundleDetail"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such bundle in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/trial-balance": {
      "get": {
        "operationId": "getReportsTrialBalance",
        "tags": [
          "Reports"
        ],
        "summary": "Get the trial balance",
        "description": "The group tree with ledger leaves and signed closing balances. Only the period from the start of the financial year to today is stored. For any other period the API asks Tally live, so the call can wait up to 90 seconds. If Tally cannot answer you get `200` with `status` and no figures, so check for `status` first.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": true,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Required.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Period start, `YYYY-MM-DD`. Default is the start of the financial year containing `to`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Period end, `YYYY-MM-DD`. Default today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The statement, or a body with `status` and no figures. Check for `status` before you read any figure.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/TrialBalance"
                    },
                    {
                      "$ref": "#/components/schemas/StatementUnavailable"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "You sent no `company`. A date is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          },
          "500": {
            "description": "The stored statement could not be read and Tally could not be reached."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/profit-and-loss": {
      "get": {
        "operationId": "getReportsProfitAndLoss",
        "tags": [
          "Reports"
        ],
        "summary": "Get the profit and loss",
        "description": "Income and expense trees with net profit. Only the period from the start of the financial year to today is stored. For any other period the API asks Tally live, so the call can wait up to 90 seconds. If Tally cannot answer you get `200` with `status` and no figures, so check for `status` first.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": true,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Required.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Period start, `YYYY-MM-DD`. Default is the start of the financial year containing `to`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Period end, `YYYY-MM-DD`. Default today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The statement, or a body with `status` and no figures. Check for `status` before you read any figure.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ProfitAndLoss"
                    },
                    {
                      "$ref": "#/components/schemas/StatementUnavailable"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "You sent no `company`. A date is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          },
          "500": {
            "description": "The stored statement could not be read and Tally could not be reached."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/balance-sheet": {
      "get": {
        "operationId": "getReportsBalanceSheet",
        "tags": [
          "Reports"
        ],
        "summary": "Get the balance sheet",
        "description": "Liability and asset trees as at a date. Only the period from the start of the financial year to today is stored. For any other period the API asks Tally live, so the call can wait up to 90 seconds. If Tally cannot answer you get `200` with `status` and no figures, so check for `status` first.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": true,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Required.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "description": "Balances as at this date, `YYYY-MM-DD`. Default today.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The statement, or a body with `status` and no figures. Check for `status` before you read any figure.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/BalanceSheet"
                    },
                    {
                      "$ref": "#/components/schemas/StatementUnavailable"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "You sent no `company`. A date is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          },
          "500": {
            "description": "The stored statement could not be read and Tally could not be reached."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/gstr-1": {
      "get": {
        "operationId": "getReportsGstr1",
        "tags": [
          "Reports"
        ],
        "summary": "Get GSTR-1",
        "description": "Outward supplies for a period: section summaries, the HSN summary and documents issued. Send `section` to page through one section's invoices.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Period start, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Period end, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "description": "Return this section's invoices in `invoices`.",
            "schema": {
              "type": "string",
              "enum": [
                "b2b",
                "b2cl",
                "b2cs",
                "cdnr",
                "cdnur",
                "exports",
                "deemedExports",
                "nilExempt"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Pages the `section` rows. Ignored without `section`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Pages the `section` rows, up to 1000. Ignored without `section`.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "gstin",
            "in": "query",
            "required": false,
            "description": "The GSTIN to compute this return for. Send it when the company has more than one GST registration: each GSTIN files its own return, and without it the figures cover every registration together. `registration.gstin` in the response says which one it covers.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9A-Za-z]{15}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Gstr1Report"
                }
              }
            }
          },
          "400": {
            "description": "`from` or `to` is missing or malformed, or there are several companies and no `company`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name. `gstin` is not one of the company's GST registrations."
          },
          "409": {
            "description": "Some vouchers were synced before AutoTally recorded their GST registration. Sync them again from Tally."
          },
          "422": {
            "description": "The company is a composition dealer for this period."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/gstr-3b": {
      "get": {
        "operationId": "getReportsGstr3b",
        "tags": [
          "Reports"
        ],
        "summary": "Get GSTR-3B",
        "description": "The summary return for a period: tables 3.1, 3.2, 4 and 5. `excluded[]` lists the tables this report does not produce, and why.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Period start, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Period end, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "gstin",
            "in": "query",
            "required": false,
            "description": "The GSTIN to compute this return for. Send it when the company has more than one GST registration: each GSTIN files its own return, and without it the figures cover every registration together. `registration.gstin` in the response says which one it covers.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9A-Za-z]{15}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Gstr3bReport"
                }
              }
            }
          },
          "400": {
            "description": "`from` or `to` is missing or malformed, or there are several companies and no `company`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name. `gstin` is not one of the company's GST registrations."
          },
          "409": {
            "description": "Some vouchers were synced before AutoTally recorded their GST registration. Sync them again from Tally."
          },
          "422": {
            "description": "The company is a composition dealer for this period."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/hsn-summary": {
      "get": {
        "operationId": "getReportsHsnSummary",
        "tags": [
          "Reports"
        ],
        "summary": "Get the HSN summary",
        "description": "One row per HSN and rate for a period. For outward supplies this matches table 12 of GSTR-1.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Period start, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Period end, `YYYY-MM-DD`, inclusive. Required.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "supply",
            "in": "query",
            "required": false,
            "description": "Direction to summarise.",
            "schema": {
              "type": "string",
              "enum": [
                "outward",
                "inward"
              ],
              "default": "outward"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HsnSummaryReport"
                }
              }
            }
          },
          "400": {
            "description": "`from` or `to` is missing or malformed, or there are several companies and no `company`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/tds-deductions": {
      "get": {
        "operationId": "getReportsTdsDeductions",
        "tags": [
          "Reports"
        ],
        "summary": "Get the TDS and TCS register",
        "description": "Deductions from your synced vouchers, one row each, with period totals. If a period is too large, `truncated` is `true` and the totals are incomplete.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Earliest voucher date, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Latest voucher date, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "taxType",
            "in": "query",
            "required": false,
            "description": "`TDS` or `TCS`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "section",
            "in": "query",
            "required": false,
            "description": "Only this section.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "party",
            "in": "query",
            "required": false,
            "description": "Exact party ledger name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TdsDeductionsReport"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/reports/cost-centres": {
      "get": {
        "operationId": "getReportsCostCentres",
        "tags": [
          "Reports"
        ],
        "summary": "Get the cost centre report",
        "description": "Totals per cost centre, with the allocations behind them. Allocations split money already in a ledger line, so never add `net` to a voucher or ledger total.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Earliest voucher date, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Latest voucher date, inclusive.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "costCentre",
            "in": "query",
            "required": false,
            "description": "Exact cost centre name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Exact cost category name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number, from 1.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 1000. A larger value is cut to 1000 without an error, so read `pageSize` in the response.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CostCentreReport"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/outstandings": {
      "get": {
        "operationId": "getOutstandings",
        "tags": [
          "Outstandings and analytics"
        ],
        "summary": "List outstandings",
        "description": "Bill-wise receivables and payables with due dates and ageing per party. This returns the full set, with no paging. Amounts are signed: positive is debit, negative is credit.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "party",
            "in": "query",
            "required": false,
            "description": "Only this party ledger.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Only receivables or only payables.",
            "schema": {
              "type": "string",
              "enum": [
                "receivable",
                "payable"
              ]
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": false,
            "description": "Age as at this date, `YYYY-MM-DD`. The result is approximate: read `approximate`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "buckets",
            "in": "query",
            "required": false,
            "description": "Ageing edges in days, comma-separated and ascending, for example `30,60,90`. Up to 6.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fresh",
            "in": "query",
            "required": false,
            "description": "Set to `true` to ask for a sooner refresh of this company. Needs `company`. The response is still the synced copy, and this never reads Tally.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutstandingsResponse"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/analytics/items/{item}": {
      "get": {
        "operationId": "getAnalyticsItemsItem",
        "tags": [
          "Outstandings and analytics"
        ],
        "summary": "Get item analytics",
        "description": "Last and average prices, quantity movement and open orders for one stock item, worked out from your synced vouchers.",
        "parameters": [
          {
            "name": "item",
            "in": "path",
            "required": true,
            "description": "Stock item name, URL-encoded.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Period start, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Period end, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemAnalytics"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/analytics/parties/{party}": {
      "get": {
        "operationId": "getAnalyticsPartiesParty",
        "tags": [
          "Outstandings and analytics"
        ],
        "summary": "Get party analytics",
        "description": "Last transaction, totals, average days to pay and open orders for one party, worked out from your synced vouchers.",
        "parameters": [
          {
            "name": "party",
            "in": "path",
            "required": true,
            "description": "Party ledger name, URL-encoded.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company name, exactly as `GET /v1/companies` returns it. Case-sensitive. Optional only when the workspace has one company.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Period start, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Period end, `YYYY-MM-DD`.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartyAnalytics"
                }
              }
            }
          },
          "400": {
            "description": "The workspace has several companies and you sent no `company`, or a parameter is malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No company with that name."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents": {
      "get": {
        "operationId": "getDocuments",
        "tags": [
          "Documents"
        ],
        "summary": "List documents",
        "description": "Returns documents newest first. Filters combine with AND. Follow `nextCursor` for the next page. It is absent on the last page. Rows carry no file links: use `GET /v1/documents/{id}` for those.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company GUID. Cannot be combined with `filed=none`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filed",
            "in": "query",
            "required": false,
            "description": "`none` selects documents with no filing.",
            "schema": {
              "type": "string",
              "enum": [
                "none"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Only this kind of document.",
            "schema": {
              "type": "string",
              "enum": [
                "purchase-invoice",
                "sales-invoice",
                "bank-statement",
                "receipt",
                "other",
                "bill-of-supply",
                "proforma-invoice",
                "purchase-order",
                "delivery-challan",
                "quotation",
                "unknown"
              ]
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "description": "Only documents that arrived this way.",
            "schema": {
              "type": "string",
              "enum": [
                "chat",
                "email",
                "whatsapp",
                "telegram",
                "slack"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Earliest received date. This is when it reached AutoTally, not the date printed on it.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Latest received date.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Text to find in the supplier, document number or file name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 100.",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "An unknown `kind`, `channel` or `filed`, `company` with `filed=none`, or a malformed cursor."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "postDocuments",
        "tags": [
          "Documents"
        ],
        "summary": "Upload a document",
        "description": "Stores a document and reads it. With `company`, it is filed into that company. Without it, it is stored unfiled and supplier matching waits until you file it. Uploading the same bytes again returns the existing document with `duplicate: true`. Use a key with writes allowed for uploads and changes.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The document."
                  },
                  "company": {
                    "type": "string",
                    "description": "Company GUID to file it into. Optional."
                  },
                  "channel": {
                    "type": "string",
                    "default": "chat",
                    "enum": [
                      "chat",
                      "email",
                      "whatsapp",
                      "telegram",
                      "slack"
                    ],
                    "description": "How it arrived. Default `chat`."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Stored and read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "No file part, or an unknown `channel`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "The workspace has no credits for reading."
          },
          "413": {
            "description": "The file is over the size limit. The workspace is out of document storage."
          },
          "415": {
            "description": "The body is not `multipart/form-data`."
          },
          "502": {
            "description": "Stored, but reading failed. The body has `state: failed`."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}": {
      "get": {
        "operationId": "getDocumentsId",
        "tags": [
          "Documents"
        ],
        "summary": "Get a document",
        "description": "Returns a document's details and what was extracted, with a link to open it that lasts 60 seconds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetail"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/content": {
      "get": {
        "operationId": "getDocumentsIdContent",
        "tags": [
          "Documents"
        ],
        "summary": "Download a document",
        "description": "Returns the stored bytes of an uploaded document, or of a generated one (an `id` from `GET /v1/documents/generated`). This route serves files up to 15 MB. For anything larger, use the `url` from `GET /v1/documents/{id}` or `GET /v1/documents/generated/{id}`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          },
          "413": {
            "description": "The document is over 15 MB."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/thumb": {
      "get": {
        "operationId": "getDocumentsIdThumb",
        "tags": [
          "Documents"
        ],
        "summary": "Get a thumbnail",
        "description": "Redirects to a thumbnail image through a link that lasts 60 seconds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the thumbnail."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No thumbnail, or no such document."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/generated": {
      "get": {
        "operationId": "getDocumentsGenerated",
        "tags": [
          "Documents"
        ],
        "summary": "List generated documents",
        "description": "Returns the files generated in your workspace, newest first: reports and documents printed from your books. Filters combine with AND. Follow `nextCursor` for the next page. It is absent on the last page. Rows carry no file links: use `GET /v1/documents/generated/{id}` for those.",
        "parameters": [
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company GUID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Text to find in the title.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `nextCursor` from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, up to 100.",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeneratedDocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A malformed cursor."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/generated/{id}": {
      "get": {
        "operationId": "getDocumentsGeneratedId",
        "tags": [
          "Documents"
        ],
        "summary": "Get a generated document",
        "description": "Returns a fresh link to a report a member of your workspace generated. A key can read these, not create them.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The generated document's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeneratedDocumentDetail"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such generated document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/generated/{id}/thumb": {
      "get": {
        "operationId": "getDocumentsGeneratedIdThumb",
        "tags": [
          "Documents"
        ],
        "summary": "Get a generated document's thumbnail",
        "description": "Redirects to a preview of the first page through a link that lasts 60 seconds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The generated document's id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the thumbnail."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No thumbnail, or no such generated document."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/text": {
      "get": {
        "operationId": "getDocumentsIdText",
        "tags": [
          "Documents"
        ],
        "summary": "Read a document's text",
        "description": "Returns the document's text, page by page. By default it returns a few pages from `from`, not the whole document.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First page, from 1. Default 1.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last page, inclusive. Default two pages after `from`.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentTextResponse"
                }
              }
            }
          },
          "400": {
            "description": "`to` is before `from`."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/rows": {
      "get": {
        "operationId": "getDocumentsIdRows",
        "tags": [
          "Documents"
        ],
        "summary": "Read statement rows",
        "description": "Returns the transactions recorded for a statement, and whether they reconcile against the statement's running balance. Only post from a statement when `mayPost` is `true`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "First page whose rows to return, from 1.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Last page whose rows to return, inclusive.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRowsResponse"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "putDocumentsIdRows",
        "tags": [
          "Documents"
        ],
        "summary": "Record statement rows",
        "description": "Records the transactions on one page of a statement and returns how the whole document now reconciles. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDocumentRowsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveDocumentRowsResponse"
                }
              }
            }
          },
          "400": {
            "description": "A row is malformed. The message names the row."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/companies": {
      "post": {
        "operationId": "postDocumentsIdCompanies",
        "tags": [
          "Documents"
        ],
        "summary": "File a document into a company",
        "description": "Files a document into a company. Safe to repeat: filing it twice changes nothing. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Company GUID."
                  }
                },
                "required": [
                  "companyGuid"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Already filed there. Nothing changed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFilings"
                }
              }
            }
          },
          "201": {
            "description": "Filed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFilings"
                }
              }
            }
          },
          "400": {
            "description": "`companyGuid` is missing or blank."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/companies/{companyGuid}": {
      "delete": {
        "operationId": "deleteDocumentsIdCompaniesCompanyGuid",
        "tags": [
          "Documents"
        ],
        "summary": "Remove a filing",
        "description": "Removes a document from a company and withdraws the entries made from it that can still be withdrawn. `retained[]` reports the rest. Do not assume a bill left the books: check `retained`. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyGuid",
            "in": "path",
            "required": true,
            "description": "Company GUID.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "companies": {
                      "type": "array",
                      "description": "Filings that remain.",
                      "items": {
                        "type": "string"
                      }
                    },
                    "withdrawn": {
                      "type": "array",
                      "description": "Ids of the writes withdrawn.",
                      "items": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "retained": {
                      "type": "array",
                      "description": "Entries that could not be withdrawn.",
                      "items": {
                        "$ref": "#/components/schemas/RetainedIntent"
                      }
                    }
                  },
                  "required": [
                    "documentId",
                    "companies",
                    "withdrawn",
                    "retained"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/deep-read": {
      "post": {
        "operationId": "postDocumentsIdDeepRead",
        "tags": [
          "Documents"
        ],
        "summary": "Deep read a document",
        "description": "Reads the document a second time with an independent reader and merges the result. This spends workspace credits. Where the readings disagree the field becomes `disputed`. Settle it with `/resolve`. Asking again serves the stored result and charges nothing. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyGuid": {
                    "type": "string",
                    "description": "Which company to rebuild the posting in. Needed when it is filed into more than one."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string"
                    },
                    "extraction": {
                      "$ref": "#/components/schemas/DocumentExtraction"
                    },
                    "bundleId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "deepRead": {
                      "type": "object",
                      "description": "Always `available: false, alreadyRead: true` here.",
                      "properties": {
                        "available": {
                          "type": "boolean"
                        },
                        "reasons": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "alreadyRead": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "required": [
                    "documentId",
                    "extraction",
                    "bundleId",
                    "deepRead"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "402": {
            "description": "The workspace has no credits. Nothing was spent."
          },
          "404": {
            "description": "No such document in this workspace."
          },
          "409": {
            "description": "The document has no first reading to compare with."
          },
          "503": {
            "description": "The second reader is not available."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/resolve": {
      "post": {
        "operationId": "postDocumentsIdResolve",
        "tags": [
          "Documents"
        ],
        "summary": "Settle a disputed field",
        "description": "Picks one reading of each disputed field, then rebuilds the proposed posting. Only fields that are currently `disputed` can be named. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FieldResolutionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetail"
                }
              }
            }
          },
          "400": {
            "description": "`resolutions` is missing or malformed."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          },
          "409": {
            "description": "A named field is not disputed. No field is disputed. The document is filed into no company. The document is not filed into that company. It is filed into several companies. Send `companyGuid`."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/documents/{id}/repropose": {
      "post": {
        "operationId": "postDocumentsIdRepropose",
        "tags": [
          "Documents"
        ],
        "summary": "Rebuild a posting",
        "description": "Rebuilds the proposed posting for a document that ended up without one. `bundleId` can be null even on success: read `flags`. Use a key with writes allowed for uploads and changes.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The `documentId`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force": {
                    "type": "boolean",
                    "description": "Post it even though the document's kind says it should not be. Other checks still apply."
                  },
                  "companyGuid": {
                    "type": "string",
                    "description": "Which company to rebuild the posting in. Needed when it is filed into more than one."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "bundleId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    },
                    "flags": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BundleFlag"
                      }
                    }
                  },
                  "required": [
                    "documentId",
                    "bundleId",
                    "flags"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          },
          "404": {
            "description": "No such document in this workspace."
          },
          "409": {
            "description": "The document was never read. The document is filed into no company. The document is not filed into that company. It is filed into several companies. Send `companyGuid`. It already has an entry. An entry is approved or on its way to Tally."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/rules": {
      "get": {
        "operationId": "getRules",
        "tags": [
          "Rules and playbooks"
        ],
        "summary": "List rules",
        "description": "Returns every live rule in the workspace. Show `summary` to people. `rule.subject` is a lookup key, not display text.",
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleListResponse"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/rules/export": {
      "get": {
        "operationId": "getRulesExport",
        "tags": [
          "Rules and playbooks"
        ],
        "summary": "Export rules",
        "description": "Downloads the rules as a ZIP of Markdown files, one per live rule, with a change log.",
        "responses": {
          "200": {
            "description": "Success."
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/v1/playbooks": {
      "get": {
        "operationId": "getPlaybooks",
        "tags": [
          "Rules and playbooks"
        ],
        "summary": "List playbooks",
        "description": "Returns your workspace's playbooks. Each is a written procedure for one shape of source document.",
        "parameters": [
          {
            "name": "includeDisabled",
            "in": "query",
            "required": false,
            "description": "Set to `true` to include switched-off playbooks.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookListResponse"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, invalid or revoked."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A workspace API key, starting tapi_."
      }
    },
    "schemas": {
      "AdditionalChargeInput": {
        "type": "object",
        "properties": {
          "ledger": {
            "type": "string",
            "description": "Ledger name for the charge."
          },
          "amount": {
            "type": "number",
            "description": "Signed amount: positive debit, negative credit."
          },
          "isApportioned": {
            "type": "boolean",
            "description": "`true` to spread the charge across the stock lines, otherwise it posts as a flat ledger line."
          }
        },
        "required": [
          "ledger",
          "amount"
        ]
      },
      "AgentRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Rule id."
          },
          "companyGuid": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company it applies to. Null means the whole workspace."
          },
          "userId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Person it applies to. Null means everyone."
          },
          "kind": {
            "type": "string",
            "enum": [
              "party-ledger-map",
              "party-fact",
              "validation-threshold",
              "workflow-note",
              "company-account-map"
            ],
            "description": "Kind of rule."
          },
          "subject": {
            "type": "string",
            "description": "Normalised lookup key. Not for display: use `subjectLabel`."
          },
          "subjectLabel": {
            "type": "string",
            "description": "The subject as a person wrote it."
          },
          "outcome": {
            "type": "object",
            "description": "What the rule does. The shape depends on `kind`.",
            "additionalProperties": true
          },
          "learnedFrom": {
            "type": "string",
            "enum": [
              "correction",
              "chat",
              "manual"
            ],
            "description": "How it came to exist: a correction, a chat, or typed in by hand."
          },
          "learnedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was learned."
          },
          "verifiedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who reviewed it. Null if nobody has."
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was reviewed."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "stable",
              "deprecated"
            ],
            "description": "`deprecated` means revoked."
          },
          "staleAfter": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Date after which it should be reviewed."
          },
          "validFrom": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "First voucher date it applies to. Null means no start."
          },
          "validTo": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Last voucher date it applies to. Null means no end."
          },
          "supersedes": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The rule this one replaces."
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a person revoked it."
          },
          "revokedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who revoked it."
          }
        },
        "required": [
          "id",
          "companyGuid",
          "userId",
          "kind",
          "subject",
          "subjectLabel",
          "outcome",
          "learnedFrom",
          "learnedAt",
          "verifiedBy",
          "verifiedAt",
          "status",
          "staleAfter",
          "validFrom",
          "validTo",
          "supersedes",
          "revokedAt",
          "revokedBy"
        ]
      },
      "AgingBucket": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Bucket label, e.g. \"0-30\", \"31-60\", \"90+\"."
          },
          "amount": {
            "type": "number"
          }
        },
        "required": [
          "label",
          "amount"
        ]
      },
      "AttendanceTypeInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Attendance type name."
          },
          "parent": {
            "type": "string",
            "description": "Parent attendance type. Must exist in this company."
          },
          "attendanceProductionType": {
            "type": "string",
            "description": "Kind of attendance type. `Production` is the only value known to work."
          },
          "baseUnits": {
            "type": "string",
            "description": "Unit of attendance. Must exist in this company."
          },
          "attendancePeriod": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "asOriginal": {
            "type": "boolean"
          },
          "showInReport": {
            "type": "boolean"
          }
        },
        "required": [
          "name"
        ]
      },
      "BalanceSheet": {
        "type": "object",
        "properties": {
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "asOf": {
            "type": "string",
            "format": "date"
          },
          "liabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          },
          "totalLiabilities": {
            "type": "number"
          },
          "totalAssets": {
            "type": "number"
          }
        },
        "required": [
          "asOf",
          "liabilities",
          "assets",
          "totalLiabilities",
          "totalAssets"
        ]
      },
      "BankAllocation": {
        "type": "object",
        "properties": {
          "transferMode": {
            "type": "string",
            "description": "How the money moved, for example `NEFT` or `Cheque`."
          },
          "instrumentNumber": {
            "type": "string"
          },
          "instrumentDate": {
            "type": "string",
            "format": "date",
            "description": "`YYYY-MM-DD`."
          },
          "bankersDate": {
            "type": "string",
            "format": "date",
            "description": "`YYYY-MM-DD`; set by Tally's bank reconciliation."
          },
          "utr": {
            "type": "string"
          },
          "paymentFavouring": {
            "type": "string"
          },
          "bankPartyName": {
            "type": "string"
          },
          "paymentMode": {
            "type": "string"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Signed like the entry: positive = debit."
          },
          "transactionType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Transfer mode printed on the payment, for example `RTGS`. Read it beside `transferMode`: Tally keeps it even on a cheque."
          },
          "accountNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "Beneficiary account number."
          },
          "bankName": {
            "type": [
              "string",
              "null"
            ],
            "description": "Beneficiary bank."
          },
          "ifsc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Beneficiary IFSC."
          }
        }
      },
      "BankAllocationInput": {
        "type": "object",
        "properties": {
          "transferMode": {
            "type": "string",
            "enum": [
              "Cheque",
              "NEFT",
              "RTGS",
              "IMPS",
              "UPI",
              "ECS",
              "DD",
              "Inter Bank Transfer",
              "Same Bank Transfer",
              "Cash",
              "Card",
              "Electronic Cheque",
              "Electronic DD/PO"
            ],
            "description": "How the money moved."
          },
          "instrumentNumber": {
            "type": "string",
            "description": "Cheque or instrument number."
          },
          "instrumentDate": {
            "type": "string",
            "format": "date",
            "description": "Instrument date, `YYYY-MM-DD`."
          },
          "utr": {
            "type": "string",
            "description": "Bank transaction reference (UTR)."
          },
          "paymentFavouring": {
            "type": "string",
            "description": "Payee name."
          }
        },
        "required": [
          "transferMode"
        ]
      },
      "BatchAllocation": {
        "type": "object",
        "properties": {
          "batchName": {
            "type": "string"
          },
          "godownName": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "amount": {
            "type": "number"
          },
          "orderNo": {
            "type": "string",
            "description": "Order number, when Tally stores one."
          },
          "orderDueDate": {
            "type": "string",
            "format": "date"
          },
          "trackingNo": {
            "type": "string"
          },
          "mfgDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Manufacturing date of the batch."
          },
          "expiryDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Expiry date of the batch."
          }
        }
      },
      "BatchAllocationInput": {
        "type": "object",
        "properties": {
          "godown": {
            "type": "string",
            "description": "Godown name."
          },
          "batch": {
            "type": "string",
            "description": "Batch name."
          },
          "quantity": {
            "type": "number",
            "description": "Quantity in this batch."
          },
          "amount": {
            "type": "number",
            "description": "Amount in this batch."
          }
        },
        "required": [
          "quantity",
          "amount"
        ]
      },
      "BillAllocation": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "billType": {
            "type": "string",
            "enum": [
              "New Ref",
              "Agst Ref",
              "Advance",
              "On Account"
            ]
          },
          "amount": {
            "type": "number"
          },
          "dueDate": {
            "type": "string",
            "format": "date",
            "description": "Bill due date (`YYYY-MM-DD`); null when only a credit period is set."
          },
          "creditPeriod": {
            "type": "string",
            "description": "Credit-period text, e.g. \"30 Days\"."
          }
        }
      },
      "BillAllocationInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Bill reference, for example your invoice number. Required unless `billType` is `On Account`."
          },
          "billType": {
            "type": "string",
            "enum": [
              "New Ref",
              "Agst Ref",
              "Advance",
              "On Account"
            ],
            "description": "`New Ref` raises a bill, `Agst Ref` settles one."
          },
          "amount": {
            "type": "number",
            "description": "Signed like the ledger line."
          },
          "dueDate": {
            "type": "string",
            "format": "date",
            "description": "Bill due date, `YYYY-MM-DD`."
          },
          "creditPeriod": {
            "type": "string",
            "description": "Free text such as `30 Days`. Ignored if `dueDate` is set."
          }
        },
        "required": [
          "billType",
          "amount"
        ]
      },
      "BundleDetail": {
        "type": "object",
        "properties": {
          "bundleId": {
            "type": "string",
            "format": "uuid",
            "description": "The bundle."
          },
          "companyGuid": {
            "type": "string",
            "description": "Company GUID."
          },
          "documentId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The document it was proposed from, if any."
          },
          "intents": {
            "type": "array",
            "description": "The writes, in the order they apply.",
            "items": {
              "$ref": "#/components/schemas/BundleIntent"
            }
          },
          "flags": {
            "type": "array",
            "description": "Things a person should look at.",
            "items": {
              "$ref": "#/components/schemas/BundleFlag"
            }
          },
          "requiresFieldResolution": {
            "type": "boolean",
            "description": "Two readings of a figure disagree and nobody has picked one."
          },
          "requiresAccountMapping": {
            "type": "boolean",
            "description": "The posting names an account the books lack, or hold twice."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "applied",
              "rejected",
              "failed"
            ],
            "description": "The bundle's state, taken from its worst member."
          }
        },
        "required": [
          "bundleId",
          "companyGuid",
          "documentId",
          "intents",
          "flags",
          "state"
        ]
      },
      "BundleFlag": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "low-confidence",
              "duplicate-bill",
              "unbalanced",
              "unknown-account",
              "ambiguous-account",
              "missing-total",
              "missing-date",
              "supplier-unreadable",
              "supplier-ambiguous",
              "missing-invoice-number",
              "missing-field",
              "gstin-invalid",
              "line-item-arithmetic",
              "no-bridge",
              "agent-authors",
              "not-postable",
              "proposal-failed",
              "rule-target-missing",
              "gstin-mismatch",
              "over-threshold",
              "new-party-proposed",
              "expense-equals-party",
              "expense-not-an-expense-account",
              "field-disputed",
              "reading-disagreement",
              "kind-overridden",
              "not-filed",
              "not-filed-there",
              "ambiguous-company",
              "field-contradicted"
            ]
          },
          "field": {
            "type": "string",
            "description": "The extracted field this concerns."
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "BundleIntent": {
        "type": "object",
        "properties": {
          "intentId": {
            "type": "string",
            "format": "uuid",
            "description": "The write."
          },
          "seq": {
            "type": "integer",
            "description": "Position within the bundle."
          },
          "op": {
            "type": "string",
            "description": "What kind of write it is."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "claimed",
              "submitted",
              "applied",
              "failed",
              "rejected"
            ],
            "description": "State of this write."
          },
          "payload": {
            "type": "object",
            "description": "The write's content.",
            "additionalProperties": true
          },
          "approvedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a person approved it."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed, if it did."
          },
          "appliedRules": {
            "type": "array",
            "description": "Rules that shaped or flagged this write.",
            "items": {
              "$ref": "#/components/schemas/RuleCitation"
            }
          }
        },
        "required": [
          "intentId",
          "seq",
          "op",
          "state"
        ]
      },
      "Company": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "guid": {
            "type": "string"
          },
          "startingFrom": {
            "type": "string",
            "format": "date"
          },
          "booksFrom": {
            "type": "string",
            "format": "date",
            "description": "Start of the accounts."
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "formalName": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "description": "Registered address, as one string."
          },
          "state": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "pincode": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "mobileNumber": {
            "type": "string"
          },
          "faxNumber": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "description": "Email address."
          },
          "website": {
            "type": "string"
          },
          "pan": {
            "type": "string"
          },
          "cin": {
            "type": "string"
          },
          "tanNumber": {
            "type": "string"
          },
          "tanRegNumber": {
            "type": "string"
          },
          "tdsDeductorType": {
            "type": "string"
          },
          "tdsDeductorBranch": {
            "type": "string"
          },
          "isGSTOn": {
            "type": "boolean",
            "description": "GST is on."
          },
          "isInventoryOn": {
            "type": "boolean",
            "description": "Inventory is on."
          },
          "isPayrollOn": {
            "type": "boolean",
            "description": "Payroll is on."
          },
          "isBillWiseOn": {
            "type": "boolean",
            "description": "Bill-wise accounting is on."
          },
          "isCostCentresOn": {
            "type": "boolean",
            "description": "Cost centres are on."
          },
          "isTDSOn": {
            "type": "boolean",
            "description": "TDS is on."
          },
          "isTCSOn": {
            "type": "boolean",
            "description": "TCS is on."
          },
          "isInterestOn": {
            "type": "boolean",
            "description": "Interest is on."
          },
          "integrateAccountsWithInventory": {
            "type": "boolean",
            "description": "Accounts are integrated with inventory."
          },
          "features": {
            "description": "The same switches as one object.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CompanyFeatures"
              }
            ]
          }
        }
      },
      "CompanyFeatures": {
        "type": "object",
        "properties": {
          "inventory": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "integrateAccountsWithInventory": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Accounts are integrated with inventory."
          },
          "billWise": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "costCentres": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "tds": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "tcs": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "gst": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "payroll": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "interest": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "ConsigneeDetails": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "gstin": {
            "type": "string",
            "description": "GSTIN."
          },
          "pincode": {
            "type": "string"
          }
        }
      },
      "CostCategoryInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Cost category name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          },
          "allocateRevenue": {
            "type": "boolean",
            "description": "Allocate revenue items."
          },
          "allocateNonRevenue": {
            "type": "boolean",
            "description": "Allocate non-revenue items."
          }
        },
        "required": [
          "name"
        ]
      },
      "CostCentreAllocation": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string"
          },
          "costCentre": {
            "type": "string"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Signed like the entry: positive = debit."
          }
        }
      },
      "CostCentreAllocationInput": {
        "type": "object",
        "properties": {
          "costCentre": {
            "type": "string",
            "description": "Cost centre name."
          },
          "amount": {
            "type": "number",
            "description": "Signed like the ledger line."
          },
          "category": {
            "type": "string",
            "description": "Cost category name."
          }
        },
        "required": [
          "costCentre",
          "amount"
        ]
      },
      "CostCentreAllocationRow": {
        "type": "object",
        "properties": {
          "voucherGuid": {
            "type": "string"
          },
          "voucherNumber": {
            "type": "string"
          },
          "voucherDate": {
            "type": "string",
            "format": "date"
          },
          "voucherType": {
            "type": "string"
          },
          "ledgerName": {
            "type": "string",
            "description": "The ledger line this allocation splits."
          },
          "costCentre": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "description": "The cost category the allocation names, which need not match the master's."
          },
          "amount": {
            "type": "number",
            "description": "Signed like the ledger line it came from."
          }
        }
      },
      "CostCentreInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Cost centre name."
          },
          "parent": {
            "type": "string",
            "description": "Parent cost centre. Must exist in this company."
          },
          "category": {
            "type": "string",
            "description": "Cost category. Must exist in this company."
          }
        },
        "required": [
          "name"
        ]
      },
      "CostCentreReport": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "page": {
            "type": "integer"
          },
          "pageSize": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostCentreAllocationRow"
            }
          },
          "centres": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CostCentreSummaryRow"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/CostCentreSummary"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the period exceeded the report row cap and these totals are incomplete."
          }
        }
      },
      "CostCentreSummary": {
        "type": "object",
        "properties": {
          "debit": {
            "type": "number"
          },
          "credit": {
            "type": "number"
          },
          "net": {
            "type": "number"
          },
          "allocations": {
            "type": "integer"
          },
          "centresWithActivity": {
            "type": "integer"
          },
          "centresWithoutActivity": {
            "type": "integer"
          },
          "legsAllocated": {
            "type": "integer",
            "description": "Ledger lines with at least one allocation."
          }
        },
        "required": [
          "debit",
          "credit",
          "net",
          "allocations",
          "centresWithActivity",
          "centresWithoutActivity",
          "legsAllocated"
        ]
      },
      "CostCentreSummaryRow": {
        "type": "object",
        "properties": {
          "costCentre": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "parent": {
            "type": "string",
            "description": "Parent name."
          },
          "debit": {
            "type": "number",
            "description": "Sum of positive allocation amounts."
          },
          "credit": {
            "type": "number",
            "description": "Sum of credit allocations, as a positive number."
          },
          "net": {
            "type": "number",
            "description": "Debit - credit; the signed net."
          },
          "allocations": {
            "type": "integer"
          },
          "noActivity": {
            "type": "boolean",
            "description": "The centre exists but nothing posted to it in this period."
          },
          "unknownMaster": {
            "type": "boolean",
            "description": "Allocations name this centre but no record matches."
          }
        },
        "required": [
          "costCentre",
          "debit",
          "credit",
          "net",
          "allocations",
          "noActivity"
        ]
      },
      "CurrencyInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The currency symbol, for example `$`."
          },
          "formalName": {
            "type": "string",
            "description": "The currency's name, for example `US Dollar`."
          }
        },
        "required": [
          "name"
        ]
      },
      "CurrencyRate": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "standard",
              "buying",
              "selling"
            ],
            "description": "Which rate series this is. Do not merge them."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Base-currency units per ONE foreign unit."
          },
          "specifiedRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "A rate an operator typed rather than one derived from a transaction. Usually null."
          }
        }
      },
      "DeepReadOffer": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "`true` if a second read is on offer."
          },
          "credits": {
            "type": "integer",
            "description": "Estimated credits. Absent when not available."
          },
          "reasons": {
            "type": "array",
            "description": "Why it is offered.",
            "items": {
              "type": "string"
            }
          },
          "alreadyRead": {
            "type": "boolean",
            "description": "`true` once paid for. Asking again charges nothing."
          }
        },
        "required": [
          "available",
          "reasons",
          "alreadyRead"
        ]
      },
      "DispatchDetails": {
        "type": "object",
        "properties": {
          "fromName": {
            "type": "string"
          },
          "fromState": {
            "type": "string"
          },
          "fromPincode": {
            "type": "string"
          },
          "fromPlace": {
            "type": "string"
          }
        }
      },
      "DocsIssuedRow": {
        "type": "object",
        "properties": {
          "voucherType": {
            "type": "string"
          },
          "series": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "description": "First document number in the period."
          },
          "to": {
            "type": "string",
            "description": "Last document number in the period."
          },
          "totalNumber": {
            "type": "integer"
          },
          "cancelled": {
            "type": "integer"
          }
        },
        "required": [
          "voucherType",
          "series",
          "totalNumber",
          "cancelled"
        ]
      },
      "DocumentDetail": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "companies": {
            "type": "array",
            "description": "Every company it is filed into. Empty when unfiled.",
            "items": {
              "type": "string"
            }
          },
          "kind": {
            "type": "string",
            "enum": [
              "purchase-invoice",
              "sales-invoice",
              "bank-statement",
              "receipt",
              "other",
              "bill-of-supply",
              "proforma-invoice",
              "purchase-order",
              "delivery-challan",
              "quotation",
              "unknown"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Document number, when one was read."
          },
          "mime": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "sourceChannel": {
            "type": "string",
            "enum": [
              "chat",
              "email",
              "whatsapp",
              "telegram",
              "slack"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "received",
              "extracting",
              "extracted",
              "failed",
              "proposed",
              "deleted"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "extraction": {
            "$ref": "#/components/schemas/DocumentExtraction",
            "description": "What was read from it."
          },
          "bundleId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The approval bundle proposed from it, if any."
          },
          "url": {
            "type": "string",
            "description": "A link to the file, valid for `urlExpiresInSeconds`."
          },
          "urlExpiresInSeconds": {
            "type": "integer",
            "description": "How long `url` lasts."
          },
          "deepRead": {
            "$ref": "#/components/schemas/DeepReadOffer",
            "description": "Whether a second read is worth buying."
          }
        },
        "required": [
          "documentId",
          "companies",
          "kind",
          "mime",
          "sizeBytes",
          "sourceChannel",
          "state",
          "createdAt",
          "bundleId"
        ]
      },
      "DocumentExtraction": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "description": "Kind of document, as read."
          },
          "fields": {
            "type": "object",
            "description": "The fields read, by name.",
            "additionalProperties": {
              "$ref": "#/components/schemas/DocumentExtractionField"
            }
          },
          "pages": {
            "type": "integer",
            "description": "Page count."
          },
          "lineItems": {
            "type": "array",
            "description": "Line items, as read.",
            "items": {
              "$ref": "#/components/schemas/DocumentLineItem"
            }
          },
          "guards": {
            "type": "array",
            "description": "Checks the reading failed.",
            "items": {
              "$ref": "#/components/schemas/DocumentGuard"
            }
          }
        }
      },
      "DocumentExtractionField": {
        "type": "object",
        "properties": {
          "value": {
            "description": "String or number. Null means the document does not print it."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Confidence from 0 to 1."
          },
          "method": {
            "type": "string",
            "enum": [
              "labelled",
              "heuristic",
              "model",
              "deep",
              "corroborated",
              "disputed",
              "absent"
            ],
            "description": "How the value was obtained. `disputed` means two readers disagree: show both."
          },
          "alternative": {
            "$ref": "#/components/schemas/ExtractionAlternative",
            "description": "The other reading. Present when `method` is `disputed`."
          }
        }
      },
      "DocumentFilings": {
        "type": "object",
        "description": "Every company a document is filed into, ordered by guid. Empty means unfiled.",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "documentId",
          "companies"
        ]
      },
      "DocumentGuard": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "gstin-invalid",
              "tax-arithmetic",
              "line-item-arithmetic",
              "required-field-missing"
            ]
          },
          "field": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "DocumentKind": {
        "type": "string",
        "enum": [
          "purchase-invoice",
          "sales-invoice",
          "bank-statement",
          "receipt",
          "other",
          "bill-of-supply",
          "proforma-invoice",
          "purchase-order",
          "delivery-challan",
          "quotation",
          "unknown"
        ]
      },
      "DocumentLineItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": [
              "number",
              "null"
            ]
          },
          "rate": {
            "type": [
              "number",
              "null"
            ]
          },
          "amount": {
            "type": "number"
          },
          "hsn": {
            "type": [
              "string",
              "null"
            ],
            "description": "HSN or SAC code."
          }
        },
        "required": [
          "description",
          "quantity",
          "rate",
          "amount"
        ]
      },
      "DocumentListResponse": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentSummary"
            }
          },
          "nextCursor": {
            "type": "string",
            "description": "Pass this as `cursor`. Absent on the last page."
          }
        },
        "required": [
          "documents"
        ]
      },
      "DocumentPage": {
        "type": "object",
        "properties": {
          "pageNo": {
            "type": "integer",
            "description": "Page number, from 1."
          },
          "text": {
            "type": "string",
            "description": "The page's text. An empty string is a real answer."
          }
        },
        "required": [
          "pageNo",
          "text"
        ]
      },
      "DocumentRowsProgress": {
        "type": "object",
        "properties": {
          "pageCount": {
            "type": "integer",
            "description": "Pages of text stored for this document."
          },
          "pagesRecorded": {
            "type": "array",
            "description": "Pages that have rows.",
            "items": {
              "type": "integer"
            }
          },
          "pagesRemaining": {
            "type": "array",
            "description": "Pages that do not.",
            "items": {
              "type": "integer"
            }
          },
          "nextPage": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The first page with no rows, or null when none remain."
          }
        },
        "required": [
          "pageCount",
          "pagesRecorded",
          "pagesRemaining",
          "nextPage"
        ]
      },
      "DocumentRowsResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string"
          },
          "totalRows": {
            "type": "integer",
            "description": "Rows recorded for the whole document."
          },
          "progress": {
            "$ref": "#/components/schemas/DocumentRowsProgress"
          },
          "reconciliation": {
            "$ref": "#/components/schemas/StatementReconciliation"
          },
          "mayPost": {
            "type": "boolean",
            "description": "`true` only when `reconciliation.status` is `reconciled`."
          },
          "refusal": {
            "type": "string",
            "description": "Why not, naming the page and row. Empty when `mayPost` is `true`."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatementRowRecord"
            }
          }
        },
        "required": [
          "documentId",
          "totalRows",
          "progress",
          "reconciliation",
          "mayPost",
          "refusal",
          "rows"
        ]
      },
      "DocumentSummary": {
        "type": "object",
        "description": "One library row. Deliberately NOT a DocumentDetail: it carries no `url` and no `urlExpiresInSeconds`, and it never will. Thumbnail presence is a boolean.",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "companies": {
            "type": "array",
            "description": "Every company it is filed into. Empty when unfiled.",
            "items": {
              "type": "string"
            }
          },
          "entryCount": {
            "type": "integer",
            "description": "Entries made from this document."
          },
          "kind": {
            "type": "string",
            "enum": [
              "purchase-invoice",
              "sales-invoice",
              "bank-statement",
              "receipt",
              "other",
              "bill-of-supply",
              "proforma-invoice",
              "purchase-order",
              "delivery-challan",
              "quotation",
              "unknown"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Document number, when one was read."
          },
          "supplier": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who issued it, as read. Null if nothing was read."
          },
          "documentDate": {
            "type": [
              "string",
              "null"
            ],
            "description": "The date printed on the document. Null if none was found."
          },
          "mime": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer"
          },
          "sourceChannel": {
            "type": "string",
            "enum": [
              "chat",
              "email",
              "whatsapp",
              "telegram",
              "slack"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "received",
              "extracting",
              "extracted",
              "failed",
              "proposed",
              "deleted"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it reached AutoTally."
          },
          "bundleId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The approval bundle proposed from it, if any."
          },
          "postingState": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "approved",
              "applied",
              "rejected",
              "failed"
            ],
            "description": "What became of that bundle."
          },
          "hasThumb": {
            "type": "boolean",
            "description": "`true` if a thumbnail exists."
          }
        },
        "required": [
          "documentId",
          "companies",
          "entryCount",
          "kind",
          "supplier",
          "documentDate",
          "mime",
          "sizeBytes",
          "sourceChannel",
          "state",
          "createdAt",
          "bundleId",
          "postingState",
          "hasThumb"
        ]
      },
      "DocumentTextResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string"
          },
          "pageCount": {
            "type": "integer",
            "description": "Pages of text stored. `0` means none."
          },
          "pages": {
            "type": "array",
            "description": "The pages you asked for.",
            "items": {
              "$ref": "#/components/schemas/DocumentPage"
            }
          }
        },
        "required": [
          "documentId",
          "pageCount",
          "pages"
        ]
      },
      "DocumentUploadResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "received",
              "extracting",
              "extracted",
              "failed",
              "proposed",
              "deleted"
            ]
          },
          "extraction": {
            "$ref": "#/components/schemas/DocumentExtraction",
            "description": "What was read from it."
          },
          "errorMessage": {
            "type": "string",
            "description": "Why reading failed, if it did."
          },
          "bundleId": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The approval bundle proposed from it, if any."
          },
          "duplicate": {
            "type": "boolean",
            "description": "`true` if these exact bytes were already on file. `documentId` then names the existing document."
          },
          "deepRead": {
            "$ref": "#/components/schemas/DeepReadOffer",
            "description": "Whether a second read is worth buying."
          }
        },
        "required": [
          "documentId",
          "state",
          "bundleId"
        ]
      },
      "DryRunResult": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "Always `true` here. A failed dry run is a 400."
          },
          "dryRun": {
            "type": "boolean",
            "description": "Always `true` here."
          }
        },
        "required": [
          "valid",
          "dryRun"
        ]
      },
      "EInvoiceDetails": {
        "type": "object",
        "properties": {
          "irn": {
            "type": "string",
            "description": "E-invoice IRN."
          },
          "ackNo": {
            "type": "string"
          },
          "ackDate": {
            "type": "string"
          },
          "qrCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Signed QR payload of the e-invoice."
          }
        }
      },
      "EmployeeGroupInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Employee group name."
          },
          "parent": {
            "type": "string",
            "description": "Parent employee group. Must exist in this company."
          },
          "category": {
            "type": "string",
            "description": "Cost category. Must exist in this company."
          }
        },
        "required": [
          "name"
        ]
      },
      "EmployeeInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Employee name."
          },
          "employeeGroup": {
            "type": "string",
            "description": "Employee group. Must exist in this company."
          },
          "category": {
            "type": "string",
            "description": "Cost category. Must exist in this company."
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date",
            "description": "Date of birth, `YYYY-MM-DD`."
          },
          "dateOfJoin": {
            "type": "string",
            "format": "date",
            "description": "Date of joining, `YYYY-MM-DD`."
          },
          "gender": {
            "type": "string"
          },
          "bloodGroup": {
            "type": "string"
          },
          "designation": {
            "type": "string"
          },
          "function": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "emailId": {
            "type": "string"
          },
          "contactNumbers": {
            "type": "string"
          },
          "panNumber": {
            "type": "string",
            "description": "PAN."
          },
          "aadharNumber": {
            "type": "string"
          },
          "uanNumber": {
            "type": "string"
          },
          "pfAccountNumber": {
            "type": "string"
          },
          "esiNumber": {
            "type": "string"
          },
          "bankAccountNumber": {
            "type": "string"
          },
          "ifsCode": {
            "type": "string"
          },
          "fatherName": {
            "type": "string"
          },
          "spouseName": {
            "type": "string"
          },
          "empDisplayName": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      },
      "EwayBill": {
        "type": "object",
        "properties": {
          "billNumber": {
            "type": "string"
          },
          "billDate": {
            "type": "string",
            "format": "date"
          },
          "validUpto": {
            "type": "string",
            "format": "date"
          },
          "documentType": {
            "type": "string"
          },
          "subType": {
            "type": "string"
          }
        }
      },
      "ExciseJurisdictionInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "range": {
            "type": "string"
          },
          "division": {
            "type": "string"
          },
          "commissionerate": {
            "type": "string"
          }
        }
      },
      "ExcludedReportTable": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "table",
          "reason"
        ]
      },
      "ExtractionAlternative": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "value": {},
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Confidence of the other reading."
          },
          "method": {
            "type": "string",
            "enum": [
              "labelled",
              "heuristic",
              "model",
              "deep",
              "corroborated",
              "disputed",
              "absent"
            ]
          }
        },
        "required": [
          "value",
          "method"
        ]
      },
      "FieldResolutionRequest": {
        "type": "object",
        "properties": {
          "resolutions": {
            "type": "object",
            "description": "Field name to the reading that wins: `ours` keeps the current value, `deep` takes the second reading.",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "ours",
                "deep"
              ]
            }
          },
          "companyGuid": {
            "type": "string",
            "description": "Which company to rebuild the posting in. Needed when it is filed into more than one."
          }
        },
        "required": [
          "resolutions"
        ]
      },
      "Forex": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Currency."
          },
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Foreign amount, signed like the line's own amount."
          },
          "rateOfExchange": {
            "type": [
              "number",
              "null"
            ],
            "description": "Base currency units per one foreign unit. Absent at exactly 1:1."
          }
        }
      },
      "GenerateDocumentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "format": {
            "type": "string",
            "enum": [
              "xlsx",
              "pdf",
              "docx",
              "png",
              "md"
            ],
            "description": "File format."
          },
          "bytes": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "A short-lived link to the file. Call this route again for a new one."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When `url` stops working."
          }
        },
        "required": [
          "id",
          "format",
          "bytes",
          "title",
          "url",
          "expiresAt"
        ]
      },
      "GeneratedDocumentDetail": {
        "description": "GET /v1/documents/generated/{id}: a fresh link, plus whose document it is, read from the stored row.",
        "allOf": [
          {
            "$ref": "#/components/schemas/GenerateDocumentResponse"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "render",
                  "script",
                  "book"
                ],
                "description": "What produced it: a report, a script, or a document printed from the books."
              },
              "companyGuid": {
                "type": "string",
                "description": "The company the document belongs to."
              }
            },
            "required": [
              "kind",
              "companyGuid"
            ]
          }
        ]
      },
      "GeneratedDocumentListResponse": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GeneratedDocumentSummary"
            }
          },
          "nextCursor": {
            "type": "string"
          }
        },
        "required": [
          "documents"
        ]
      },
      "GeneratedDocumentSummary": {
        "type": "object",
        "description": "One row of the generated-documents library. Carries no URL.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "render",
              "script",
              "book"
            ],
            "description": "What produced it: `render` is a report, `script` is a file an analysis wrote, `book` is a document printed from the books, such as an invoice."
          },
          "format": {
            "type": "string",
            "enum": [
              "xlsx",
              "pdf",
              "docx",
              "png",
              "md"
            ]
          },
          "title": {
            "type": "string"
          },
          "bytes": {
            "type": "integer"
          },
          "companyGuid": {
            "type": "string",
            "description": "Company GUID, from `GET /v1/companies`. Required to commit."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "threadId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The chat thread it was generated in."
          },
          "hasThumb": {
            "type": "boolean",
            "description": "Whether a page-one preview exists. A boolean."
          }
        },
        "required": [
          "id",
          "kind",
          "format",
          "title",
          "bytes",
          "companyGuid",
          "createdAt",
          "threadId",
          "hasThumb"
        ]
      },
      "GodownAlterRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GodownInput"
          },
          {
            "type": "object",
            "properties": {
              "newName": {
                "type": "string",
                "description": "New name for the record."
              }
            }
          }
        ]
      },
      "GodownInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Godown name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          }
        },
        "required": [
          "name"
        ]
      },
      "GroupAlterRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GroupInput"
          },
          {
            "type": "object",
            "properties": {
              "newName": {
                "type": "string",
                "description": "New name for the record."
              }
            }
          }
        ]
      },
      "GroupInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Group name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          },
          "parent": {
            "type": "string",
            "description": "Parent group. Must exist in this company."
          },
          "isRevenue": {
            "type": "boolean",
            "description": "The group is a revenue group."
          },
          "isDeemedPositive": {
            "type": "boolean",
            "description": "Debit is the positive side of this group."
          },
          "affectGrossProfit": {
            "type": "boolean",
            "description": "Balances here affect gross profit."
          },
          "isSubledger": {
            "type": "boolean",
            "description": "Treat the group as a sub-ledger."
          },
          "addlAllocType": {
            "type": "string",
            "enum": [
              "Not Applicable",
              "Appropriate by Qty",
              "Appropriate by Value",
              "Appropriate by condition"
            ],
            "description": "How values are apportioned on an invoice."
          },
          "isCalculable": {
            "type": "boolean",
            "description": "Used in calculations."
          },
          "isAddable": {
            "type": "boolean",
            "description": "Sub-ledgers add up in reports."
          }
        },
        "required": [
          "name"
        ]
      },
      "GstDetail": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "calculationType": {
            "type": "string",
            "description": "How the tax is calculated, for example `On Value`."
          },
          "calculateSlabOnMrp": {
            "type": "boolean",
            "description": "Work out the rate slab on MRP."
          },
          "natureOfTransaction": {
            "type": "string",
            "description": "GST nature of transaction."
          },
          "isNonGstGoods": {
            "type": "boolean",
            "description": "Non-GST goods."
          },
          "taxability": {
            "type": "string",
            "description": "Taxability."
          },
          "sourceOfGstDetails": {
            "type": "string",
            "description": "Where the GST details come from."
          },
          "isReverseChargeApplicable": {
            "type": "boolean",
            "description": "Reverse charge applies."
          },
          "isIneligibleForItc": {
            "type": "boolean",
            "description": "Not eligible for input tax credit."
          },
          "includeExpForSlabCalc": {
            "type": "boolean",
            "description": "Include expenses when working out the rate slab."
          },
          "stateWiseDetails": {
            "type": "array",
            "description": "Rates by state.",
            "items": {
              "$ref": "#/components/schemas/StateWiseGst"
            }
          }
        }
      },
      "GstDetailInput": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "calculationType": {
            "type": "string",
            "description": "How the tax is calculated, for example `On Value`."
          },
          "calculateSlabOnMrp": {
            "type": "boolean",
            "description": "Work out the rate slab on MRP."
          },
          "natureOfTransaction": {
            "type": "string",
            "enum": [
              "Branch Transfer Outward",
              "Local Sales - Exempt",
              "Local Sales - Nil Rated",
              "Local Sales - Taxable",
              "Interstate Sales - Exempt",
              "Interstate Sales - Nil Rated",
              "Interstate Sales - Taxable",
              "Interstate Deemed Exports - Exempt",
              "Interstate Deemed Exports - Nil Rated",
              "Interstate Deemed Exports - Taxable",
              "Local Deemed Exports - Exempt",
              "Local Deemed Exports - Nil Rated",
              "Local Deemed Exports - Taxable",
              "Exports - Exempt",
              "Exports - Nil Rated",
              "Exports - Taxable",
              "Exports - LUT/Bond",
              "Sales to SEZ - Exempt",
              "Sales to SEZ - Nil Rated",
              "Sales to SEZ - Taxable",
              "Sales to SEZ - LUT/Bond",
              "High Sea Sales",
              "Sales from Customs Bonded Warehouse",
              "Branch Transfer Inward",
              "Local Purchase - Exempt",
              "Local Purchase - Nil Rated",
              "Local Purchase - Taxable",
              "Interstate Purchase - Exempt",
              "Interstate Purchase - Nil Rated",
              "Interstate Purchase - Taxable",
              "Local Purchase Deemed Exports - Exempt",
              "Local Purchase Deemed Exports - Nil Rated",
              "Local Purchase Deemed Exports - Taxable",
              "Interstate Purchase Deemed Exports - Exempt",
              "Interstate Purchase Deemed Exports - Nil Rated",
              "Interstate Purchase Deemed Exports - Taxable",
              "Purchase from Composition Dealer",
              "Imports - Exempt",
              "Imports - Nil Rated",
              "Imports - Taxable",
              "Purchase from SEZ - Exempt",
              "Purchase from SEZ - Nil Rated",
              "Purchase from SEZ - Taxable",
              "Purchase from SEZ - LUT/Bond",
              "Purchase from SEZ (Without Bill of Entry) - Exempt",
              "Purchase from SEZ (Without Bill of Entry) - Nil Rated",
              "Purchase from SEZ (Without Bill of Entry) - Taxable",
              "High Sea Purchases",
              "Purchase from Customs Bonded Warehouse",
              "Local Sales - Non GST",
              "Local Deemed Exports - Non GST",
              "Interstate Sales - Non GST",
              "Interstate Deemed Exports - Non GST",
              "Exports - Non GST",
              "Sales to SEZ - Non GST",
              "Local Purchase - Non GST",
              "Interstate Purchase - Non GST",
              "Local Purchase Deemed Exports - Non GST",
              "Interstate Purchase Deemed Exports - Non GST",
              "Imports - Non GST",
              "DTA Imports - Non GST",
              "DTA Exports - Non GST",
              "Purchase from SEZ - Non GST",
              "Purchase from SEZ (Without Bill of Entry) - Non GST"
            ],
            "description": "GST nature of transaction."
          },
          "isNonGstGoods": {
            "type": "boolean",
            "description": "Non-GST goods."
          },
          "taxability": {
            "type": "string",
            "enum": [
              "Taxable",
              "Exempt",
              "Nil Rated",
              "Unknown",
              "Non-GST"
            ],
            "description": "Taxability."
          },
          "sourceOfGstDetails": {
            "type": "string",
            "description": "Where the GST details come from."
          },
          "isReverseChargeApplicable": {
            "type": "boolean",
            "description": "Reverse charge applies."
          },
          "isIneligibleForItc": {
            "type": "boolean",
            "description": "Not eligible for input tax credit."
          },
          "includeExpForSlabCalc": {
            "type": "boolean",
            "description": "Include expenses when working out the rate slab."
          },
          "stateWiseDetails": {
            "type": "array",
            "description": "Rates by state.",
            "items": {
              "$ref": "#/components/schemas/StateWiseGstInput"
            }
          }
        }
      },
      "GstRate": {
        "type": "object",
        "properties": {
          "dutyHead": {
            "type": "string",
            "description": "Duty head, for example `CGST`, `SGST/UTGST`, `IGST` or `Cess`."
          },
          "gstRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Rate percentage."
          },
          "valuationType": {
            "type": "string",
            "description": "Valuation type, for example `Based on Value`."
          }
        }
      },
      "GstRateDetail": {
        "type": "object",
        "properties": {
          "dutyHead": {
            "type": "string",
            "description": "Duty head, for example `CGST`, `SGST/UTGST`, `IGST` or `Cess`."
          },
          "rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percent."
          },
          "valuationType": {
            "type": "string",
            "description": "Valuation type, for example `Based on Value`."
          }
        }
      },
      "GstRateInput": {
        "type": "object",
        "properties": {
          "dutyHead": {
            "type": "string",
            "description": "Duty head, for example `CGST`, `SGST/UTGST`, `IGST` or `Cess`."
          },
          "gstRate": {
            "type": "number",
            "description": "Rate percentage."
          },
          "valuationType": {
            "type": "string",
            "description": "Valuation type, for example `Based on Value`."
          }
        },
        "required": [
          "dutyHead",
          "gstRate"
        ]
      },
      "GstRegistrationDetail": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "gstRegistrationType": {
            "type": "string",
            "description": "GST registration type."
          },
          "state": {
            "type": "string"
          },
          "placeOfSupply": {
            "type": "string"
          },
          "isOtherTerritoryAssesse": {
            "type": "boolean"
          },
          "isStateCessOn": {
            "type": "boolean"
          }
        }
      },
      "GstSectionSummary": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "taxableValue": {
            "type": "number"
          },
          "igst": {
            "type": "number"
          },
          "cgst": {
            "type": "number"
          },
          "sgst": {
            "type": "number"
          },
          "cess": {
            "type": "number"
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "count",
          "taxableValue",
          "igst",
          "cgst",
          "sgst",
          "cess",
          "total"
        ]
      },
      "Gstr1InvoiceRow": {
        "type": "object",
        "description": "A single document inside a GSTR-1 section, returned only for the requested `?section=` drill-down.",
        "properties": {
          "voucherGuid": {
            "type": "string",
            "description": "The voucher's Tally GUID."
          },
          "voucherType": {
            "type": "string",
            "description": "The voucher's own type name as Tally states it (\"Sales\", \"Credit Note\", a renamed book)."
          },
          "voucherNumber": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "partyName": {
            "type": "string"
          },
          "partySource": {
            "type": "string",
            "enum": [
              "tally",
              "derived"
            ],
            "description": "`tally` if Tally stated the party, `derived` if it was read from the party line."
          },
          "partyGstin": {
            "type": "string"
          },
          "placeOfSupply": {
            "type": "string"
          },
          "reverseCharge": {
            "type": "boolean",
            "description": "Omitted when no rate line carries the flag. Absent does not mean no reverse charge."
          },
          "invoiceValue": {
            "type": "number",
            "description": "Document value, stated positive."
          },
          "classificationSource": {
            "type": "string",
            "enum": [
              "tally",
              "inferred"
            ],
            "description": "Whether this document's section came from Tally's own nature-of-transaction or was inferred here."
          },
          "rates": {
            "type": "array",
            "description": "Rate-wise breakup of the document.",
            "items": {
              "type": "object",
              "properties": {
                "rate": {
                  "type": "number"
                },
                "taxableValue": {
                  "type": "number"
                },
                "igst": {
                  "type": "number"
                },
                "cgst": {
                  "type": "number"
                },
                "sgst": {
                  "type": "number"
                },
                "cess": {
                  "type": "number"
                }
              },
              "required": [
                "rate",
                "taxableValue",
                "igst",
                "cgst",
                "sgst",
                "cess"
              ]
            }
          }
        },
        "required": [
          "classificationSource",
          "rates"
        ]
      },
      "Gstr1Report": {
        "type": "object",
        "properties": {
          "basis": {
            "type": "string",
            "enum": [
              "computed from synced books"
            ],
            "description": "How the report was made. For reconciliation, not filing."
          },
          "coverage": {
            "$ref": "#/components/schemas/ReportCoverage"
          },
          "classification": {
            "$ref": "#/components/schemas/ReportClassification"
          },
          "period": {
            "$ref": "#/components/schemas/ReportPeriod"
          },
          "registration": {
            "$ref": "#/components/schemas/ReportGstRegistration"
          },
          "sections": {
            "type": "object",
            "description": "One summary per GSTR-1 section. Every key is always present (a section with nothing in it reports zeroes and count 0).",
            "properties": {
              "b2b": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "B2B supplies."
              },
              "b2cl": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "B2C large supplies."
              },
              "b2cs": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "B2C small supplies."
              },
              "cdnr": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Credit and debit notes, registered."
              },
              "cdnur": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Credit and debit notes, unregistered."
              },
              "exports": {
                "$ref": "#/components/schemas/GstSectionSummary"
              },
              "deemedExports": {
                "$ref": "#/components/schemas/GstSectionSummary"
              },
              "nilExempt": {
                "$ref": "#/components/schemas/GstSectionSummary"
              }
            },
            "required": [
              "b2b",
              "b2cl",
              "b2cs",
              "cdnr",
              "cdnur",
              "exports",
              "deemedExports",
              "nilExempt"
            ]
          },
          "hsn": {
            "type": "array",
            "description": "Table 12: the HSN summary.",
            "items": {
              "$ref": "#/components/schemas/HsnSummaryRow"
            }
          },
          "docsIssued": {
            "type": "array",
            "description": "Table 13: documents issued, including cancelled ones.",
            "items": {
              "$ref": "#/components/schemas/DocsIssuedRow"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/GstSectionSummary"
          },
          "invoices": {
            "type": "object",
            "description": "Present when you sent `section`: that section's rows, paged.",
            "properties": {
              "section": {
                "type": "string"
              },
              "page": {
                "type": "integer"
              },
              "pageSize": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Gstr1InvoiceRow"
                }
              }
            },
            "required": [
              "section",
              "page",
              "pageSize",
              "total",
              "items"
            ]
          }
        },
        "required": [
          "basis",
          "coverage",
          "classification",
          "period",
          "registration",
          "sections",
          "hsn",
          "docsIssued",
          "summary"
        ]
      },
      "Gstr3bPlaceOfSupplyRow": {
        "type": "object",
        "properties": {
          "placeOfSupply": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxableValue": {
            "type": "number"
          },
          "igst": {
            "type": "number"
          },
          "cgst": {
            "type": "number"
          },
          "sgst": {
            "type": "number"
          },
          "cess": {
            "type": "number"
          }
        },
        "required": [
          "placeOfSupply",
          "taxableValue",
          "igst",
          "cgst",
          "sgst",
          "cess"
        ]
      },
      "Gstr3bReport": {
        "type": "object",
        "properties": {
          "basis": {
            "type": "string",
            "enum": [
              "computed from synced books"
            ],
            "description": "How the report was made. For reconciliation, not filing."
          },
          "reverseCharge": {
            "type": "object",
            "description": "What could be read about reverse charge on inward documents.",
            "properties": {
              "documentsUnstated": {
                "type": "integer",
                "description": "Inward documents that state no reverse charge flag."
              },
              "exemptLinesExcluded": {
                "type": "integer",
                "description": "Reverse charge lines left out because the supply is also marked exempt."
              }
            },
            "required": [
              "documentsUnstated",
              "exemptLinesExcluded"
            ]
          },
          "coverage": {
            "$ref": "#/components/schemas/ReportCoverage"
          },
          "classification": {
            "$ref": "#/components/schemas/ReportClassification"
          },
          "period": {
            "$ref": "#/components/schemas/ReportPeriod"
          },
          "registration": {
            "$ref": "#/components/schemas/ReportGstRegistration"
          },
          "tables": {
            "type": "object",
            "properties": {
              "t31a": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 3.1(a)."
              },
              "t31b": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 3.1(b)."
              },
              "t31c": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 3.1(c)."
              },
              "t31d": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 3.1(d)."
              },
              "t31e": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 3.1(e)."
              },
              "t32": {
                "$ref": "#/components/schemas/Gstr3bTable32",
                "description": "Table 3.2, with its place of supply breakup."
              },
              "t4a3": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 4A(3)."
              },
              "t4a5": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 4A(5)."
              },
              "t4d": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 4D."
              },
              "t5": {
                "$ref": "#/components/schemas/GstSectionSummary",
                "description": "Table 5."
              }
            },
            "required": [
              "t31a",
              "t31b",
              "t31c",
              "t31d",
              "t31e",
              "t32",
              "t4a3",
              "t4a5",
              "t4d",
              "t5"
            ]
          },
          "excluded": {
            "type": "array",
            "description": "The tables this report refuses to fabricate. Always present, always non-empty.",
            "items": {
              "$ref": "#/components/schemas/ExcludedReportTable"
            }
          }
        },
        "required": [
          "basis",
          "coverage",
          "classification",
          "reverseCharge",
          "period",
          "registration",
          "tables",
          "excluded"
        ]
      },
      "Gstr3bTable32": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GstSectionSummary"
          },
          {
            "type": "object",
            "properties": {
              "byPlaceOfSupply": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Gstr3bPlaceOfSupplyRow"
                }
              }
            },
            "required": [
              "byPlaceOfSupply"
            ]
          }
        ]
      },
      "HsnDetail": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "hsnDescription": {
            "type": "string",
            "description": "HSN description."
          },
          "hsnCode": {
            "type": "string",
            "description": "HSN or SAC code."
          },
          "hsnClassificationName": {
            "type": "string",
            "description": "HSN classification name."
          },
          "source": {
            "type": "string",
            "description": "Where the HSN details come from."
          }
        }
      },
      "HsnDetailInput": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "hsnDescription": {
            "type": "string",
            "description": "HSN description."
          },
          "hsnCode": {
            "type": "string",
            "description": "HSN or SAC code."
          },
          "hsnClassificationName": {
            "type": "string",
            "description": "HSN classification name."
          },
          "source": {
            "type": "string",
            "description": "Where the HSN details come from."
          }
        }
      },
      "HsnSummaryReport": {
        "type": "object",
        "properties": {
          "basis": {
            "type": "string",
            "enum": [
              "computed from synced books"
            ],
            "description": "How the report was made. For reconciliation, not filing."
          },
          "coverage": {
            "$ref": "#/components/schemas/ReportCoverage"
          },
          "classification": {
            "$ref": "#/components/schemas/ReportClassification"
          },
          "period": {
            "$ref": "#/components/schemas/ReportPeriod"
          },
          "supply": {
            "type": "string",
            "enum": [
              "outward",
              "inward"
            ],
            "description": "Echoed, so an inward summary can never be mistaken for the GSTR-1 §12 one."
          },
          "items": {
            "type": "array",
            "description": "Sorted by (hsn, rate). A line whose books carry no HSN is omitted, never bucketed under an empty HSN; an empty period returns [].",
            "items": {
              "$ref": "#/components/schemas/HsnSummaryRow"
            }
          }
        },
        "required": [
          "basis",
          "coverage",
          "classification",
          "period",
          "supply",
          "items"
        ]
      },
      "HsnSummaryRow": {
        "type": "object",
        "properties": {
          "hsn": {
            "type": "string",
            "description": "HSN or SAC code."
          },
          "description": {
            "type": "string",
            "description": "From the ledger/stock-item HSN classification masters; omitted when no master describes this HSN."
          },
          "uqc": {
            "type": "string",
            "description": "Statutory Unit Quantity Code, when the unit maps to one."
          },
          "quantity": {
            "type": "number",
            "description": "Total quantity. Absent when it cannot be stated with certainty."
          },
          "rate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Combined GST rate for the bucket; null when the books state no rate."
          },
          "taxableValue": {
            "type": "number"
          },
          "igst": {
            "type": "number"
          },
          "cgst": {
            "type": "number"
          },
          "sgst": {
            "type": "number"
          },
          "cess": {
            "type": "number"
          }
        },
        "required": [
          "hsn",
          "rate",
          "taxableValue",
          "igst",
          "cgst",
          "sgst",
          "cess"
        ]
      },
      "IntentStatus": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "claimed",
              "submitted",
              "applied",
              "failed",
              "rejected"
            ],
            "description": "`applied` means Tally accepted the import. Confirmation is `resultGuid`."
          },
          "resultGuid": {
            "type": [
              "string",
              "null"
            ],
            "description": "GUID of the record, once it has synced back. Null until then. When it is set, read the voucher to confirm."
          },
          "resultMasterId": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Tally's numeric id, for vouchers. Null for masters."
          },
          "resultVoucherNumber": {
            "type": [
              "string",
              "null"
            ],
            "description": "The number Tally printed. Null until the voucher has synced back."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the write failed. Null otherwise."
          }
        },
        "required": [
          "state"
        ]
      },
      "InventoryEntryInput": {
        "type": "object",
        "properties": {
          "stockItemName": {
            "type": "string",
            "description": "Stock item name in this company."
          },
          "quantity": {
            "type": "number",
            "description": "Billed quantity."
          },
          "rate": {
            "type": "number",
            "description": "Rate per unit, in the stock item's base unit."
          },
          "amount": {
            "type": "number",
            "description": "Signed amount: negative for a sale (credit), positive for a purchase (debit)."
          },
          "godown": {
            "type": "string",
            "description": "Godown name."
          },
          "batch": {
            "type": "string",
            "description": "Batch name."
          },
          "batchAllocations": {
            "type": "array",
            "description": "Split across several batches. Used instead of `godown` and `batch`. Quantities and amounts must sum to the line's, ignoring sign.",
            "items": {
              "$ref": "#/components/schemas/BatchAllocationInput"
            }
          },
          "accountingLedger": {
            "type": "string",
            "description": "The sales or purchase ledger for this line. Put it here, not in `ledgerEntries`."
          },
          "discountPercent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "description": "Discount, 0 to 100."
          },
          "actualQuantity": {
            "type": "number",
            "description": "Actual quantity, when it differs from the billed `quantity`."
          },
          "orderNumber": {
            "type": "string",
            "description": "Number of an existing order this line fulfils. This does not number the voucher itself."
          },
          "orderDueDate": {
            "type": "string",
            "format": "date",
            "description": "Order due date, `YYYY-MM-DD`."
          },
          "trackingNumber": {
            "type": "string",
            "description": "Delivery or receipt note tracking number."
          },
          "isDestination": {
            "type": "boolean",
            "description": "Stock Journal only: `false` for a source line, `true` for a destination line."
          }
        },
        "required": [
          "stockItemName",
          "quantity",
          "rate",
          "amount"
        ]
      },
      "ItemAnalytics": {
        "type": "object",
        "properties": {
          "item": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "to": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "lastSalePrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "lastSaleDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "avgSalePrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "lastPurchasePrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "avgPurchasePrice": {
            "type": [
              "number",
              "null"
            ]
          },
          "qtySold": {
            "type": "number"
          },
          "qtyPurchased": {
            "type": "number"
          },
          "netMovement": {
            "type": "number",
            "description": "QtyPurchased − qtySold."
          },
          "salesCount": {
            "type": "integer"
          },
          "purchaseCount": {
            "type": "integer"
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderBook": {
            "$ref": "#/components/schemas/OrderBook"
          },
          "orderConversion": {
            "$ref": "#/components/schemas/OrderConversion"
          }
        }
      },
      "Ledger": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "guid": {
            "type": "string"
          },
          "parent": {
            "type": "string",
            "description": "Parent name."
          },
          "openingBalance": {
            "type": "number",
            "description": "Opening balance, signed: positive debit, negative credit."
          },
          "closingBalance": {
            "type": "number",
            "description": "Closing balance, signed: positive debit, negative credit."
          },
          "balanceAsOf": {
            "type": "string",
            "format": "date-time",
            "description": "When `closingBalance` was read from Tally."
          },
          "asOfUnavailable": {
            "type": "object",
            "description": "Present when you sent `asOf`. Past balances are not stored.",
            "properties": {
              "requestedAsOf": {
                "type": "string",
                "format": "date",
                "description": "The date you asked for."
              },
              "reason": {
                "type": "string",
                "enum": [
                  "historical_balance_not_stored"
                ],
                "description": "Why it could not be answered."
              },
              "message": {
                "type": "string",
                "description": "The same, in words."
              }
            }
          },
          "gstin": {
            "type": "string",
            "description": "GSTIN."
          },
          "gstRegistrationType": {
            "type": "string",
            "description": "GST registration type."
          },
          "panNumber": {
            "type": "string",
            "description": "PAN."
          },
          "email": {
            "type": "string",
            "description": "Email address."
          },
          "emailCc": {
            "type": "string",
            "description": "CC email address."
          },
          "creditLimit": {
            "type": "string",
            "description": "Credit limit, as a string."
          },
          "creditPeriodDays": {
            "type": "integer",
            "description": "Credit period in days."
          },
          "isBillWise": {
            "type": "boolean"
          },
          "isCreditCheck": {
            "type": "boolean"
          },
          "isInterestOn": {
            "type": "boolean",
            "description": "Interest is on."
          },
          "isCostCentresOn": {
            "type": "boolean",
            "description": "Cost centres are on."
          },
          "currency": {
            "type": "string",
            "description": "Currency."
          },
          "mailingName": {
            "type": "string",
            "description": "Mailing name."
          },
          "bank": {
            "$ref": "#/components/schemas/LedgerBank"
          },
          "addresses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerAddress"
            }
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerContact"
            }
          },
          "taxType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tax type."
          },
          "gstDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "GST classification history, dated, with rates by state.",
            "items": {
              "$ref": "#/components/schemas/GstDetail"
            }
          },
          "hsnDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "HSN or SAC history, dated.",
            "items": {
              "$ref": "#/components/schemas/HsnDetail"
            }
          },
          "gstRegistrations": {
            "type": [
              "array",
              "null"
            ],
            "description": "The party's GST registration history.",
            "items": {
              "$ref": "#/components/schemas/LedgerGstRegistration"
            }
          },
          "isTdsApplicable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "TDS applies."
          },
          "isTcsApplicable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "TCS applies."
          },
          "tdsDeducteeType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Deductee type."
          },
          "tdsRateName": {
            "type": [
              "string",
              "null"
            ],
            "description": "The TDS rate this ledger defaults to."
          }
        }
      },
      "LedgerAddress": {
        "type": "object",
        "properties": {
          "mailingName": {
            "type": "string",
            "description": "Mailing name."
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "state": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "pincode": {
            "type": "string"
          },
          "contactPerson": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "mobile": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "description": "Email address."
          },
          "gstin": {
            "type": "string",
            "description": "GSTIN."
          }
        }
      },
      "LedgerAddressInput": {
        "type": "object",
        "properties": {
          "addressName": {
            "type": "string",
            "description": "Label for this address."
          },
          "addressLines": {
            "type": "array",
            "description": "Address lines.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "type": "string",
            "description": "Country."
          },
          "state": {
            "type": "string",
            "description": "State."
          },
          "pinCode": {
            "type": "string",
            "description": "PIN code."
          },
          "contactPerson": {
            "type": "string",
            "description": "Contact person."
          },
          "mobileNo": {
            "type": "string",
            "description": "Mobile number."
          },
          "phoneNumber": {
            "type": "string",
            "description": "Phone number."
          },
          "faxNumber": {
            "type": "string",
            "description": "Fax number."
          },
          "email": {
            "type": "string",
            "description": "Email address."
          },
          "panNumber": {
            "type": "string",
            "description": "PAN."
          },
          "vatNumber": {
            "type": "string",
            "description": "VAT number."
          },
          "cstNumber": {
            "type": "string",
            "description": "CST number."
          },
          "gstDealerType": {
            "type": "string",
            "enum": [
              "Regular",
              "Composition",
              "Consumer",
              "Unregistered/Consumer",
              "Unregistered",
              "Unknown",
              "Government entity / TDS",
              "Regular - SEZ",
              "Regular-Deemed Exporter",
              "Regular-Exports (EOU)",
              "e-Commerce Operator",
              "Input Service Distributor",
              "Embassy/UN Body",
              "Non-Resident Taxpayer",
              "OIDAR"
            ],
            "description": "GST registration type at this address."
          },
          "gstin": {
            "type": "string",
            "description": "GSTIN at this address."
          },
          "isOtherTerritoryAssessee": {
            "type": "boolean",
            "description": "Other territory assessee."
          },
          "exciseJurisdictions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExciseJurisdictionInput"
            }
          }
        }
      },
      "LedgerAlterRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LedgerInput"
          },
          {
            "type": "object",
            "properties": {
              "newName": {
                "type": "string",
                "description": "New name for the record."
              },
              "replaceLists": {
                "type": "array",
                "description": "Lists in this request to replace whole. Each must also be present in the request.",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ]
      },
      "LedgerBank": {
        "type": "object",
        "properties": {
          "accountNumber": {
            "type": "string"
          },
          "ifsc": {
            "type": "string"
          },
          "bankName": {
            "type": "string"
          },
          "branchName": {
            "type": "string"
          },
          "swift": {
            "type": "string"
          }
        }
      },
      "LedgerContact": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "isDefaultWhatsApp": {
            "type": "boolean"
          },
          "countryIsdCode": {
            "type": "string",
            "description": "Country dialling code, with the plus sign."
          }
        }
      },
      "LedgerContactInput": {
        "type": "object",
        "properties": {
          "countryIsoCode": {
            "type": "string",
            "description": "Country code of the phone number."
          },
          "isDefaultWhatsAppNumber": {
            "type": "boolean",
            "description": "This is the default WhatsApp number."
          },
          "name": {
            "type": "string",
            "description": "Contact name."
          },
          "phoneNumber": {
            "type": "string",
            "description": "Phone number."
          }
        }
      },
      "LedgerEntryInput": {
        "type": "object",
        "properties": {
          "ledger": {
            "type": "string",
            "description": "Ledger name in this company."
          },
          "amount": {
            "type": "number",
            "description": "Signed amount: positive debit, negative credit."
          },
          "billAllocations": {
            "type": "array",
            "description": "Bill-wise split of this line. Amounts must sum to the line's signed `amount`.",
            "items": {
              "$ref": "#/components/schemas/BillAllocationInput"
            }
          },
          "costCentreAllocations": {
            "type": "array",
            "description": "Cost centre split of this line. Amounts must sum to the line's signed `amount`.",
            "items": {
              "$ref": "#/components/schemas/CostCentreAllocationInput"
            }
          },
          "bankAllocations": {
            "type": "array",
            "description": "Instrument details for a bank ledger line.",
            "items": {
              "$ref": "#/components/schemas/BankAllocationInput"
            }
          },
          "tds": {
            "$ref": "#/components/schemas/TdsAllocationInput",
            "description": "Marks this line as a TDS deduction. The line's own `amount` still carries the money."
          },
          "tcs": {
            "$ref": "#/components/schemas/TdsAllocationInput",
            "description": "Marks this line as a TCS deduction. The line's own `amount` still carries the money."
          },
          "forex": {
            "type": "object",
            "description": "Foreign currency details for this line. Omit for base currency. All three fields are required together.",
            "properties": {
              "currency": {
                "type": "string",
                "description": "Currency symbol. The company must hold this currency."
              },
              "amount": {
                "type": "number",
                "description": "Foreign amount, unsigned and non-zero. The line's `amount` carries the sign."
              },
              "rateOfExchange": {
                "type": "number",
                "description": "Base currency units per one foreign unit. The line's `amount` must equal `forex.amount` times this rate."
              }
            },
            "required": [
              "currency",
              "amount",
              "rateOfExchange"
            ]
          }
        },
        "required": [
          "ledger",
          "amount"
        ]
      },
      "LedgerGstRegistration": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "gstRegistrationType": {
            "type": [
              "string",
              "null"
            ],
            "description": "GST registration type."
          },
          "state": {
            "type": "string"
          },
          "placeOfSupply": {
            "type": "string"
          },
          "isOtherTerritoryAssesse": {
            "type": "boolean"
          },
          "considerPurchaseForExport": {
            "type": "boolean"
          },
          "isTransporter": {
            "type": "boolean"
          },
          "transporterId": {
            "type": "string"
          },
          "isCommonParty": {
            "type": "boolean"
          },
          "gstin": {
            "type": "string",
            "description": "GSTIN."
          }
        }
      },
      "LedgerGstRegistrationInput": {
        "type": "object",
        "description": "A gstRegistrationType of Regular or Composition requires a gstin.",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "gstRegistrationType": {
            "type": "string",
            "enum": [
              "Regular",
              "Composition",
              "Consumer",
              "Unregistered/Consumer",
              "Unregistered",
              "Unknown",
              "Government entity / TDS",
              "Regular - SEZ",
              "Regular-Deemed Exporter",
              "Regular-Exports (EOU)",
              "e-Commerce Operator",
              "Input Service Distributor",
              "Embassy/UN Body",
              "Non-Resident Taxpayer",
              "OIDAR"
            ],
            "description": "Registration type. `Regular` and `Composition` need `gstin`."
          },
          "state": {
            "type": "string",
            "description": "State of registration."
          },
          "placeOfSupply": {
            "type": "string",
            "description": "Default place of supply."
          },
          "isOtherTerritoryAssessee": {
            "type": "boolean",
            "description": "Other territory assessee."
          },
          "considerPurchaseForExport": {
            "type": "boolean",
            "description": "Treat purchases as for export."
          },
          "isTransporter": {
            "type": "boolean",
            "description": "The party is a transporter."
          },
          "transporterId": {
            "type": "string",
            "description": "Transporter ID."
          },
          "isCommonParty": {
            "type": "boolean",
            "description": "The party is a common party."
          },
          "gstin": {
            "type": "string",
            "description": "The party's GSTIN."
          }
        }
      },
      "LedgerInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Ledger name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          },
          "group": {
            "type": "string",
            "description": "Parent group, for example `Sundry Debtors` for a customer or `Sundry Creditors` for a supplier. Must exist in this company."
          },
          "openingBalance": {
            "type": "number",
            "description": "Opening balance, signed: positive debit, negative credit."
          },
          "currency": {
            "type": "string",
            "description": "Currency of the ledger. Must exist in this company."
          },
          "taxType": {
            "type": "string",
            "enum": [
              "GST",
              "TCS",
              "TDS",
              "Excise",
              "FBT",
              "Service Tax",
              "VAT",
              "Default",
              "CST",
              "CENVAT",
              "Krishi Kalyan Cess",
              "Swachh Bharat Cess",
              "Others"
            ],
            "description": "Set this on a duty ledger, for example `GST`."
          },
          "gstTaxType": {
            "type": "string",
            "enum": [
              "CGST",
              "Cess",
              "IGST",
              "UT Tax",
              "SGST/UTGST",
              "State Tax",
              "SGST",
              "UTGST",
              "SUTGST"
            ],
            "description": "Duty head of a GST ledger."
          },
          "rateOfTax": {
            "type": "number",
            "description": "Tax rate percentage of a duty ledger."
          },
          "appropriateFor": {
            "type": "string",
            "enum": [
              "Not Applicable",
              "Appropriate by Qty",
              "Appropriate by Value",
              "Appropriate by condition"
            ],
            "description": "How the ledger's value is apportioned on an invoice."
          },
          "isBillWise": {
            "type": "boolean",
            "description": "Keep balances bill by bill. Turn this on for customers and suppliers."
          },
          "isCostCentresOn": {
            "type": "boolean",
            "description": "Allow cost centre allocations on this ledger."
          },
          "isInterestOn": {
            "type": "boolean",
            "description": "Calculate interest on this ledger."
          },
          "isCreditCheck": {
            "type": "boolean",
            "description": "Check the credit limit on this ledger."
          },
          "creditLimit": {
            "type": "string",
            "description": "Credit limit, as a string."
          },
          "email": {
            "type": "string",
            "description": "Email address."
          },
          "emailCc": {
            "type": "string",
            "description": "CC email address."
          },
          "website": {
            "type": "string",
            "description": "Website."
          },
          "panNumber": {
            "type": "string",
            "description": "PAN."
          },
          "gstTypeOfSupply": {
            "type": "string",
            "enum": [
              "Goods",
              "Services",
              "Capital Goods"
            ],
            "description": "Type of supply on a GST ledger."
          },
          "bankName": {
            "type": "string",
            "description": "Bank name, on a bank ledger."
          },
          "accountNumber": {
            "type": "string",
            "description": "Account number, on a bank ledger."
          },
          "bankBsrCode": {
            "type": "string",
            "description": "BSR code of the bank."
          },
          "branchName": {
            "type": "string",
            "description": "Branch name."
          },
          "ifsc": {
            "type": "string",
            "description": "IFSC."
          },
          "swift": {
            "type": "string",
            "description": "SWIFT code."
          },
          "paymentDetails": {
            "type": "array",
            "description": "Bank details used for payments to this party.",
            "items": {
              "$ref": "#/components/schemas/LedgerPaymentDetailInput"
            }
          },
          "addresses": {
            "type": "array",
            "description": "Addresses of the party.",
            "items": {
              "$ref": "#/components/schemas/LedgerAddressInput"
            }
          },
          "mailingDetails": {
            "type": "array",
            "description": "Mailing address, dated.",
            "items": {
              "$ref": "#/components/schemas/LedgerMailingDetailInput"
            }
          },
          "gstRegistrationDetails": {
            "type": "array",
            "description": "The party's GST registration. This is where a party's GSTIN goes.",
            "items": {
              "$ref": "#/components/schemas/LedgerGstRegistrationInput"
            }
          },
          "gstDetails": {
            "type": "array",
            "description": "GST classification history, dated, with rates by state.",
            "items": {
              "$ref": "#/components/schemas/GstDetailInput"
            }
          },
          "hsnDetails": {
            "type": "array",
            "description": "HSN or SAC history, dated.",
            "items": {
              "$ref": "#/components/schemas/HsnDetailInput"
            }
          },
          "contactDetails": {
            "type": "array",
            "description": "Contact people.",
            "items": {
              "$ref": "#/components/schemas/LedgerContactInput"
            }
          },
          "isTdsApplicable": {
            "type": "boolean",
            "description": "TDS applies to this party."
          },
          "isTcsApplicable": {
            "type": "boolean",
            "description": "TCS applies to this party."
          },
          "tdsDeducteeType": {
            "type": "string",
            "enum": [
              "Association of Persons",
              "Body of Individuals",
              "Co-operative Society",
              "Company - Resident",
              "Company - Non Resident",
              "Individual/HUF - Resident",
              "Individual/HUF - Non Resident",
              "Firm - Resident",
              "Firm - Non Resident",
              "Government",
              "Local Authority",
              "Artificial Juridical Person",
              "Others"
            ],
            "description": "Deductee type of the party."
          },
          "tdsRateName": {
            "type": "string",
            "description": "On a duty ledger, the name of a rate from `GET /v1/tds-rates`."
          }
        },
        "required": [
          "name"
        ]
      },
      "LedgerMailingDetailInput": {
        "type": "object",
        "properties": {
          "addressLines": {
            "type": "array",
            "description": "Address lines.",
            "items": {
              "type": "string"
            }
          },
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "mailingName": {
            "type": "string",
            "description": "Name on the mailing address."
          },
          "country": {
            "type": "string",
            "description": "Country."
          },
          "state": {
            "type": "string",
            "description": "State."
          },
          "pinCode": {
            "type": "string",
            "description": "PIN code."
          }
        }
      },
      "LedgerPaymentDetailInput": {
        "type": "object",
        "properties": {
          "bankName": {
            "type": "string",
            "description": "Bank name."
          },
          "city": {
            "type": "string",
            "description": "Bank city."
          },
          "defaultTransactionType": {
            "type": "string",
            "description": "Default transfer mode."
          },
          "inFavour": {
            "type": "string",
            "description": "Payee name."
          },
          "transactionName": {
            "type": "string",
            "description": "Name for this set of details."
          },
          "chequeCrossComment": {
            "type": "string",
            "description": "Cheque crossing comment."
          },
          "setAsDefault": {
            "type": "boolean",
            "description": "Use these details by default."
          },
          "bankAccountNo": {
            "type": "string",
            "description": "Account number."
          },
          "bankBranch": {
            "type": "string",
            "description": "Branch name."
          },
          "ifsc": {
            "type": "string",
            "description": "IFSC."
          }
        }
      },
      "MasterStatistic": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "OnAccountLeg": {
        "type": "object",
        "properties": {
          "voucherGuid": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "amount": {
            "type": "number",
            "description": "The entry's full amount."
          },
          "voucherType": {
            "type": "string"
          }
        },
        "required": [
          "voucherGuid",
          "date",
          "amount"
        ]
      },
      "OrderBook": {
        "type": "object",
        "properties": {
          "openSalesOrderQty": {
            "type": "number"
          },
          "openSalesOrderValue": {
            "type": "number"
          },
          "openPurchaseOrderQty": {
            "type": "number"
          },
          "openPurchaseOrderValue": {
            "type": "number"
          }
        }
      },
      "OrderConversion": {
        "type": "object",
        "properties": {
          "degraded": {
            "type": "boolean",
            "description": "`true` when order numbers were missing, so only the order book is meaningful."
          },
          "orderedQty": {
            "type": "number"
          },
          "invoicedQty": {
            "type": "number"
          },
          "conversionRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "InvoicedQty / orderedQty; null when orderedQty === 0."
          }
        }
      },
      "OutstandingBill": {
        "type": "object",
        "properties": {
          "party": {
            "type": "string"
          },
          "billName": {
            "type": "string"
          },
          "billDate": {
            "type": "string",
            "format": "date"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "amount": {
            "type": "number",
            "description": "The bill-wise figure, signed: positive debit, negative credit."
          },
          "overdueDays": {
            "type": "integer"
          },
          "billType": {
            "type": "string",
            "enum": [
              "New Ref",
              "Agst Ref",
              "Advance",
              "On Account"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "receivable",
              "payable",
              "other"
            ],
            "description": "Set by the bill's sign: a debit bill is receivable, a credit bill is payable."
          },
          "openAmount": {
            "type": "number",
            "description": "What is still open once the party's on-account amount is applied. Prefer this to `amount` when present."
          },
          "appliedAmount": {
            "type": "number",
            "description": "`amount` minus `openAmount`."
          },
          "matchedBy": {
            "type": "array",
            "description": "The on-account entry that exactly offsets this bill, when one is known.",
            "items": {
              "$ref": "#/components/schemas/OnAccountLeg"
            }
          }
        }
      },
      "OutstandingsResponse": {
        "type": "object",
        "properties": {
          "referenceDate": {
            "type": "string",
            "format": "date"
          },
          "bills": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OutstandingBill"
            }
          },
          "aging": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartyAging"
            }
          },
          "approximate": {
            "type": "boolean",
            "description": "`true` when you sent `asOf`: the ageing covers bills still open at the last sync, so it can understate."
          },
          "parties": {
            "type": "array",
            "description": "Per-party comparison of bill-wise totals with the ledger balance. Sometimes omitted.",
            "items": {
              "$ref": "#/components/schemas/ReconciledPartySummary"
            }
          }
        }
      },
      "PartyAging": {
        "type": "object",
        "properties": {
          "party": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "receivable",
              "payable",
              "other"
            ]
          },
          "buckets": {
            "type": "array",
            "description": "Ageing buckets per the requested (or default 30/60/90) edges. Always present.",
            "items": {
              "$ref": "#/components/schemas/AgingBucket"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "party",
          "kind",
          "buckets",
          "total"
        ]
      },
      "PartyAnalytics": {
        "type": "object",
        "properties": {
          "party": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "to": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "lastTransactionDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "transactionCount": {
            "type": "integer"
          },
          "totalSalesValue": {
            "type": "number"
          },
          "totalPurchaseValue": {
            "type": "number"
          },
          "avgDaysToPay": {
            "type": [
              "number",
              "null"
            ]
          },
          "settledBillCount": {
            "type": "integer"
          },
          "openSalesOrderValue": {
            "type": "number"
          },
          "openPurchaseOrderValue": {
            "type": "number"
          }
        }
      },
      "PayHeadInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Pay head name."
          },
          "parent": {
            "type": "string",
            "description": "Parent account group, for example `Indirect Expenses`."
          },
          "payType": {
            "type": "string"
          },
          "payslipName": {
            "type": "string"
          },
          "calculationType": {
            "type": "string",
            "description": "How it is calculated, for example `On Attendance`, `Flat Rate` or `As Computed Value`."
          },
          "calculationPeriod": {
            "type": "string"
          },
          "computationType": {
            "type": "string"
          },
          "roundingMethod": {
            "type": "string"
          },
          "attendanceType": {
            "type": "string",
            "description": "Attendance type, when `calculationType` is `On Attendance`. Must exist in this company."
          },
          "leaveType": {
            "type": "string"
          },
          "payStatType": {
            "type": "string"
          },
          "showInPayslip": {
            "type": "boolean"
          },
          "userDefinedCalendarType": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "calculationType"
        ]
      },
      "PlaybookListResponse": {
        "type": "object",
        "properties": {
          "playbooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaybookRow"
            }
          }
        },
        "required": [
          "playbooks"
        ]
      },
      "PlaybookRow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Playbook id."
          },
          "companyGuid": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company it applies to. Null means the whole workspace."
          },
          "slug": {
            "type": "string",
            "description": "Its stable identifier."
          },
          "title": {
            "type": "string",
            "description": "Title."
          },
          "whenToUse": {
            "type": "string",
            "description": "One line on when it applies."
          },
          "body": {
            "type": "string",
            "description": "The procedure, in Markdown."
          },
          "documentKind": {
            "description": "Kind of document it applies to automatically. Null means by name only.",
            "allOf": [
              {
                "$ref": "#/components/schemas/DocumentKind"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ],
            "description": "`disabled` means switched off, not deleted."
          },
          "learnedFrom": {
            "type": "string",
            "enum": [
              "manual",
              "chat"
            ],
            "description": "How it was added."
          },
          "learnedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was added."
          },
          "verifiedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who vouched for the current text."
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When they did."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last change."
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was revoked."
          },
          "revokedBy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who revoked it."
          }
        },
        "required": [
          "id",
          "companyGuid",
          "slug",
          "title",
          "whenToUse",
          "body",
          "documentKind",
          "status",
          "learnedFrom",
          "learnedAt",
          "verifiedBy",
          "verifiedAt",
          "updatedAt",
          "revokedAt",
          "revokedBy"
        ]
      },
      "ProfitAndLoss": {
        "type": "object",
        "properties": {
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "income": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          },
          "expenses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          },
          "grossProfit": {
            "type": [
              "number",
              "null"
            ],
            "description": "Always null today."
          },
          "netProfit": {
            "type": "number",
            "description": "Net profit. Positive is a profit."
          },
          "openingStock": {
            "type": [
              "number",
              "null"
            ],
            "description": "Stock in hand at `from`, signed. Null when the books carry no inventory."
          },
          "closingStock": {
            "type": [
              "number",
              "null"
            ],
            "description": "Stock in hand at `to`, signed. Null when the books carry no inventory."
          }
        },
        "required": [
          "from",
          "to",
          "income",
          "expenses",
          "netProfit"
        ]
      },
      "ReconciledPartySummary": {
        "type": "object",
        "properties": {
          "party": {
            "type": "string"
          },
          "basis": {
            "type": "string",
            "enum": [
              "raw",
              "accounted",
              "fifo",
              "unreconciled"
            ],
            "description": "How the figure was reached. `raw`: the two figures agree. `accounted`: on-account entries explain the gap. `fifo`: the gap was applied oldest bill first. `unreconciled`: they could not be reconciled."
          },
          "outstanding": {
            "type": "number",
            "description": "What the party owes."
          },
          "billsNet": {
            "type": "number",
            "description": "Total of the bills."
          },
          "ledgerClosing": {
            "type": [
              "number",
              "null"
            ],
            "description": "Ledger closing balance."
          },
          "ledgerAsOf": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When that balance was read."
          },
          "delta": {
            "type": "number",
            "description": "`ledgerClosing` minus `billsNet`."
          },
          "untracked": {
            "description": "Ledger balance left over after applying the gap to bills.",
            "allOf": [
              {
                "$ref": "#/components/schemas/UntrackedLine"
              }
            ]
          },
          "note": {
            "type": "string",
            "description": "The basis, in one sentence."
          }
        },
        "required": [
          "party",
          "basis",
          "outstanding",
          "billsNet",
          "ledgerClosing",
          "ledgerAsOf",
          "delta",
          "untracked",
          "note"
        ]
      },
      "ReportClassification": {
        "type": "object",
        "properties": {
          "tallyClassified": {
            "type": "integer",
            "description": "Documents Tally classified itself."
          },
          "inferred": {
            "type": "integer",
            "description": "Documents AutoTally classified."
          }
        },
        "required": [
          "tallyClassified",
          "inferred"
        ]
      },
      "ReportCoverage": {
        "type": "object",
        "description": "What the money in a composed statutory report was computed over.",
        "properties": {
          "vouchers": {
            "type": "integer",
            "description": "Documents counted in this report."
          },
          "vouchersMissingLineAmount": {
            "type": "integer",
            "description": "Of those, how many contributed less money than they should."
          },
          "taxFromRateCard": {
            "type": "integer",
            "description": "Of those, how many had tax worked out from the item's rate, not read from duty ledgers."
          },
          "documentsOutsideBothDirections": {
            "type": "integer",
            "description": "Documents with GST rates that could not be placed as inward or outward, so they are in no total."
          },
          "documentsDirectedByPostedDuty": {
            "type": "integer",
            "description": "Documents placed by their posted GST lines, because the voucher type did not say."
          },
          "entriesRateUnknown": {
            "type": "integer",
            "description": "Entries whose GST rate could not be read. They count as rate 0."
          },
          "truncated": {
            "type": "boolean",
            "description": "`true` if the period was too large. These totals are then incomplete."
          }
        },
        "required": [
          "vouchers",
          "vouchersMissingLineAmount",
          "taxFromRateCard",
          "documentsOutsideBothDirections",
          "documentsDirectedByPostedDuty",
          "entriesRateUnknown",
          "truncated"
        ]
      },
      "ReportGstRegistration": {
        "type": "object",
        "properties": {
          "gstin": {
            "type": [
              "string",
              "null"
            ],
            "description": "GSTIN."
          },
          "stateName": {
            "type": [
              "string",
              "null"
            ],
            "description": "State name."
          },
          "registrationType": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "gstin",
          "stateName",
          "registrationType"
        ]
      },
      "ReportLine": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "group",
              "ledger"
            ]
          },
          "amount": {
            "type": "number",
            "description": "Signed: positive debit, negative credit."
          },
          "opening": {
            "type": [
              "number",
              "null"
            ],
            "description": "Opening balance. Trial balance only."
          },
          "children": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          }
        },
        "required": [
          "name",
          "type",
          "amount"
        ]
      },
      "ReportPeriod": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "from",
          "to"
        ]
      },
      "RetainedIntent": {
        "type": "object",
        "description": "An entry an unfile could NOT withdraw, and why. Reported rather than dropped: the agent has to be able to tell someone their bill is still in their books.",
        "properties": {
          "intentId": {
            "type": "string",
            "format": "uuid",
            "description": "The write."
          },
          "state": {
            "type": "string",
            "enum": [
              "applied",
              "pending",
              "claimed",
              "submitted",
              "failed"
            ],
            "description": "State of the write."
          },
          "reason": {
            "type": "string",
            "enum": [
              "already-applied",
              "approved-and-in-flight",
              "failed"
            ],
            "description": "Why it could not be withdrawn."
          },
          "voucherNumber": {
            "type": "string",
            "description": "With `already-applied`, once known. For display only."
          },
          "masterId": {
            "type": "integer",
            "description": "With `already-applied`: Tally's numeric id for the voucher."
          },
          "appliedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed state."
          }
        },
        "required": [
          "intentId",
          "state",
          "reason"
        ]
      },
      "RuleCitation": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "string",
            "format": "uuid",
            "description": "The rule."
          },
          "kind": {
            "type": "string",
            "enum": [
              "party-ledger-map",
              "party-fact",
              "validation-threshold",
              "workflow-note",
              "company-account-map"
            ],
            "description": "Kind of rule."
          },
          "subject": {
            "type": "string",
            "description": "Normalised lookup key. Not for display."
          },
          "summary": {
            "type": "string",
            "description": "What the rule does, in one sentence."
          },
          "learnedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When it was learned."
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was revoked, if it was."
          }
        },
        "required": [
          "ruleId",
          "kind",
          "subject",
          "summary",
          "learnedAt",
          "revokedAt"
        ]
      },
      "RuleListEntry": {
        "type": "object",
        "properties": {
          "rule": {
            "$ref": "#/components/schemas/AgentRule",
            "description": "The rule."
          },
          "summary": {
            "type": "string",
            "description": "What the rule does, in one sentence. Show this to people."
          },
          "replacedBy": {
            "description": "The live rule that replaced this one, or null.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RuleCitation"
              }
            ]
          },
          "appliesAfterRevoke": {
            "description": "What would apply if this rule were revoked now, or null.",
            "allOf": [
              {
                "$ref": "#/components/schemas/RuleCitation"
              }
            ]
          }
        },
        "required": [
          "rule",
          "summary",
          "replacedBy",
          "appliesAfterRevoke"
        ]
      },
      "RuleListResponse": {
        "type": "object",
        "properties": {
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleListEntry"
            }
          }
        },
        "required": [
          "rules"
        ]
      },
      "SaveDocumentRowsRequest": {
        "type": "object",
        "properties": {
          "pageNo": {
            "type": "integer",
            "minimum": 1,
            "description": "Which page of the document these rows are printed on."
          },
          "rows": {
            "type": "array",
            "description": "Every transaction on this page, in the order the page prints them.",
            "items": {
              "$ref": "#/components/schemas/StatementRowInput"
            }
          }
        },
        "required": [
          "pageNo",
          "rows"
        ]
      },
      "SaveDocumentRowsResponse": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string"
          },
          "pageNo": {
            "type": "integer"
          },
          "storedRows": {
            "type": "integer",
            "description": "How many rows this call stored for that page."
          },
          "totalRows": {
            "type": "integer",
            "description": "Rows now recorded for the whole document."
          },
          "progress": {
            "$ref": "#/components/schemas/DocumentRowsProgress"
          },
          "reconciliation": {
            "$ref": "#/components/schemas/StatementReconciliation"
          },
          "mayPost": {
            "type": "boolean"
          },
          "refusal": {
            "type": "string"
          }
        },
        "required": [
          "documentId",
          "pageNo",
          "storedRows",
          "totalRows",
          "progress",
          "reconciliation",
          "mayPost",
          "refusal"
        ]
      },
      "StateWiseGst": {
        "type": "object",
        "properties": {
          "stateName": {
            "type": "string",
            "description": "State name."
          },
          "gstRateDetails": {
            "type": "array",
            "description": "One entry per duty head.",
            "items": {
              "$ref": "#/components/schemas/GstRate"
            }
          }
        }
      },
      "StateWiseGstInput": {
        "type": "object",
        "properties": {
          "stateName": {
            "type": "string",
            "description": "State name."
          },
          "rateDetails": {
            "type": "array",
            "description": "One entry per duty head.",
            "items": {
              "$ref": "#/components/schemas/GstRateInput"
            }
          }
        },
        "required": [
          "stateName",
          "rateDetails"
        ]
      },
      "StatementChainBreak": {
        "type": "object",
        "description": "One place the recorded rows contradict the statement's own running balance.",
        "properties": {
          "pageNo": {
            "type": "integer"
          },
          "rowNo": {
            "type": "integer"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": "string",
            "description": "Row narration, cut to 80 characters."
          },
          "drcr": {
            "type": "string",
            "enum": [
              "DR",
              "CR"
            ]
          },
          "amount": {
            "type": "number"
          },
          "previousBalance": {
            "type": "number"
          },
          "expectedBalance": {
            "type": "number"
          },
          "actualBalance": {
            "type": "number"
          },
          "delta": {
            "type": "number",
            "description": "Actual minus expected balance."
          }
        },
        "required": [
          "pageNo",
          "rowNo",
          "date",
          "description",
          "drcr",
          "amount",
          "previousBalance",
          "expectedBalance",
          "actualBalance",
          "delta"
        ]
      },
      "StatementReconciliation": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "reconciled",
              "partial",
              "broken",
              "unverifiable"
            ],
            "description": "Only `reconciled` is safe to post from."
          },
          "rows": {
            "type": "integer",
            "description": "Rows checked against."
          },
          "verifiedRows": {
            "type": "integer",
            "description": "With `reconciled`: rows whose amount was checked."
          },
          "polarity": {
            "type": "string",
            "enum": [
              "CR_INCREASES",
              "DR_INCREASES"
            ],
            "description": "Which side raises the balance on this statement."
          },
          "opening": {
            "type": "number",
            "description": "With `reconciled`: opening balance."
          },
          "closing": {
            "type": "number",
            "description": "With `reconciled`: closing balance."
          },
          "checkedPairs": {
            "type": "integer",
            "description": "With `partial`: pairs of rows that could be checked."
          },
          "rowsWithoutBalance": {
            "type": "array",
            "description": "With `partial`: rows with no balance, so never checked.",
            "items": {
              "type": "integer"
            }
          },
          "breaks": {
            "type": "array",
            "description": "With `broken`: where the running balance fails.",
            "items": {
              "$ref": "#/components/schemas/StatementChainBreak"
            }
          },
          "reason": {
            "type": "string",
            "description": "With `unverifiable`: why there was nothing to check."
          }
        },
        "required": [
          "status",
          "rows"
        ]
      },
      "StatementRowInput": {
        "type": "object",
        "properties": {
          "rowNo": {
            "type": "integer",
            "minimum": 1,
            "description": "Position within the page, from 1. Omit to use the array order."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Value date, `YYYY-MM-DD`."
          },
          "description": {
            "type": "string",
            "description": "The narration as printed. Use an empty string if none."
          },
          "drcr": {
            "type": "string",
            "enum": [
              "DR",
              "CR"
            ],
            "description": "The statement's own Dr or Cr marker, copied as printed."
          },
          "amount": {
            "type": "number",
            "description": "Positive, with no grouping. `drcr` carries the direction."
          },
          "balance": {
            "type": [
              "number",
              "null"
            ],
            "description": "The balance printed after this row, signed. Negative when overdrawn. Without balances the rows cannot be checked."
          }
        },
        "required": [
          "date",
          "description",
          "drcr",
          "amount"
        ]
      },
      "StatementRowRecord": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StatementRowInput"
          },
          {
            "type": "object",
            "properties": {
              "pageNo": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": [
              "pageNo"
            ]
          }
        ]
      },
      "StatementUnavailable": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "no_snapshot_yet",
              "not_available_offline"
            ],
            "description": "`no_snapshot_yet`: nothing is stored yet. `not_available_offline`: a statement is stored, for another period."
          },
          "message": {
            "type": "string",
            "description": "What happened and what to do, in words."
          },
          "requested": {
            "type": "object",
            "description": "The period you asked for.",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              }
            },
            "required": [
              "from",
              "to"
            ]
          },
          "available": {
            "type": "object",
            "description": "The period that can be answered. Present with `not_available_offline`.",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "asOf": {
                "type": "string",
                "format": "date-time"
              }
            },
            "required": [
              "from",
              "to",
              "asOf"
            ]
          },
          "refreshRequested": {
            "type": "boolean",
            "description": "`true` if a refresh was asked for."
          }
        },
        "required": [
          "status",
          "message",
          "requested",
          "refreshRequested"
        ]
      },
      "Statistics": {
        "type": "object",
        "properties": {
          "masters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MasterStatistic"
            }
          },
          "vouchers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VoucherStatistic"
            }
          }
        }
      },
      "StockBatch": {
        "type": "object",
        "properties": {
          "batchName": {
            "type": "string"
          },
          "godownName": {
            "type": "string"
          },
          "mfgDate": {
            "type": "string"
          },
          "expiryPeriod": {
            "type": "string"
          },
          "expiryDate": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "rate": {
            "type": "number"
          },
          "value": {
            "type": "number"
          }
        }
      },
      "StockComponent": {
        "type": "object",
        "properties": {
          "componentListName": {
            "type": "string"
          },
          "baseQuantity": {
            "type": "number"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StockComponentItem"
            }
          }
        }
      },
      "StockComponentInput": {
        "type": "object",
        "properties": {
          "componentListName": {
            "type": "string",
            "description": "Name of the component list."
          },
          "baseQuantity": {
            "type": "number",
            "description": "Quantity the list makes."
          },
          "items": {
            "type": "array",
            "description": "Components.",
            "items": {
              "$ref": "#/components/schemas/StockComponentItemInput"
            }
          }
        }
      },
      "StockComponentItem": {
        "type": "object",
        "properties": {
          "natureOfComponent": {
            "type": "string"
          },
          "itemName": {
            "type": "string"
          },
          "defaultGodown": {
            "type": "string"
          },
          "actualQuantity": {
            "type": "number"
          }
        }
      },
      "StockComponentItemInput": {
        "type": "object",
        "properties": {
          "itemName": {
            "type": "string",
            "description": "Component stock item."
          },
          "defaultGodown": {
            "type": "string",
            "description": "Default godown."
          },
          "actualQuantity": {
            "type": "number",
            "description": "Quantity needed."
          }
        },
        "required": [
          "itemName"
        ]
      },
      "StockGroupInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Stock group name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          },
          "parent": {
            "type": "string",
            "description": "Parent stock group. Must exist in this company."
          },
          "isAddable": {
            "type": "boolean",
            "description": "Quantities add up in reports."
          },
          "gstApplicable": {
            "type": "string",
            "description": "Whether GST applies to the group, as Tally spells it, for example `Applicable`."
          },
          "gstDetails": {
            "type": "array",
            "description": "The group's own GST rate history. Every item under the group whose GST source is \"As per Company/Stock Group\" takes this rate. Same shape as on a stock item.",
            "items": {
              "$ref": "#/components/schemas/GstDetailInput"
            }
          },
          "hsnDetails": {
            "type": "array",
            "description": "The group's own HSN history, inherited the same way. Same shape as on a stock item.",
            "items": {
              "$ref": "#/components/schemas/HsnDetailInput"
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "StockItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "guid": {
            "type": "string"
          },
          "parent": {
            "type": "string",
            "description": "Parent name."
          },
          "baseUnit": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "openingQty": {
            "type": "number"
          },
          "openingValue": {
            "type": "number"
          },
          "hsnCode": {
            "type": "string",
            "description": "HSN or SAC code."
          },
          "gstRate": {
            "type": "number",
            "description": "Rate percentage."
          },
          "gstApplicable": {
            "type": "string"
          },
          "additionalUnits": {
            "type": "string"
          },
          "conversion": {
            "type": "number"
          },
          "denominator": {
            "type": "number"
          },
          "openingRate": {
            "type": "number"
          },
          "reorderLevel": {
            "type": "number"
          },
          "description": {
            "type": "string"
          },
          "costingMethod": {
            "type": "string"
          },
          "valuationMethod": {
            "type": "string"
          },
          "batchAllocations": {
            "type": "array",
            "description": "Stock by batch and godown.",
            "items": {
              "$ref": "#/components/schemas/StockBatch"
            }
          },
          "gstDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "GST classification history, dated, with rates by state.",
            "items": {
              "$ref": "#/components/schemas/GstDetail"
            }
          },
          "hsnDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "HSN or SAC history, dated.",
            "items": {
              "$ref": "#/components/schemas/HsnDetail"
            }
          },
          "components": {
            "type": [
              "array",
              "null"
            ],
            "description": "Bill of materials.",
            "items": {
              "$ref": "#/components/schemas/StockComponent"
            }
          }
        }
      },
      "StockItemAlterRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/StockItemInput"
          },
          {
            "type": "object",
            "properties": {
              "newName": {
                "type": "string",
                "description": "New name for the record."
              },
              "replaceLists": {
                "type": "array",
                "description": "Lists in this request to replace whole. Each must also be present in the request.",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ]
      },
      "StockItemInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Stock item name."
          },
          "alias": {
            "type": "string",
            "description": "Alternative name."
          },
          "stockGroup": {
            "type": "string",
            "description": "Stock group. Must exist in this company. For the top of the tree use `\" Primary\"`, with the leading space."
          },
          "stockCategory": {
            "type": "string",
            "description": "Stock category name."
          },
          "gstApplicable": {
            "type": "string",
            "description": "Whether GST applies, as Tally states it, for example `Applicable`."
          },
          "gstTypeOfSupply": {
            "type": "string",
            "description": "`Goods` or `Services`."
          },
          "tcsApplicable": {
            "type": "string",
            "description": "Whether TCS applies, as Tally states it."
          },
          "description": {
            "type": "string",
            "description": "Description."
          },
          "narration": {
            "type": "string",
            "description": "Notes."
          },
          "costingMethod": {
            "type": "string",
            "description": "Costing method, as Tally names it."
          },
          "valuationMethod": {
            "type": "string",
            "description": "Market valuation method, as Tally names it."
          },
          "isCostTracking": {
            "type": "boolean",
            "description": "Track costs for this item."
          },
          "isCostCentresOn": {
            "type": "boolean",
            "description": "Allow cost centre allocations on this item."
          },
          "maintainInBatches": {
            "type": "boolean",
            "description": "Keep this item in batches."
          },
          "useExpiryDates": {
            "type": "boolean",
            "description": "Track expiry dates."
          },
          "trackDateOfMfg": {
            "type": "boolean",
            "description": "Track manufacturing dates."
          },
          "baseUnit": {
            "type": "string",
            "description": "Base unit symbol. Must exist in this company. Set it whenever you send an opening quantity or rate."
          },
          "additionalUnits": {
            "type": "string",
            "description": "Alternate unit symbol. Must exist in this company."
          },
          "inclusiveOfTax": {
            "type": "boolean",
            "description": "The rate includes tax."
          },
          "denominator": {
            "type": "number",
            "description": "Base unit quantity in the alternate unit conversion."
          },
          "conversion": {
            "type": "number",
            "description": "Alternate unit quantity in the conversion."
          },
          "rateOfDuty": {
            "type": "string",
            "description": "Rate of duty, as a string."
          },
          "openingBalance": {
            "type": "number",
            "description": "Opening quantity. Needs `baseUnit`."
          },
          "openingValue": {
            "type": "number",
            "description": "Opening value, signed: positive debit, negative credit."
          },
          "openingRate": {
            "type": "number",
            "description": "Opening rate. Needs `baseUnit`."
          },
          "gstDetails": {
            "type": "array",
            "description": "GST classification history, dated, with rates by state.",
            "items": {
              "$ref": "#/components/schemas/GstDetailInput"
            }
          },
          "hsnDetails": {
            "type": "array",
            "description": "HSN or SAC history, dated.",
            "items": {
              "$ref": "#/components/schemas/HsnDetailInput"
            }
          },
          "openingBatchAllocations": {
            "type": "array",
            "description": "Opening stock by batch and godown.",
            "items": {
              "$ref": "#/components/schemas/StockOpeningBatchInput"
            }
          },
          "components": {
            "type": "array",
            "description": "Bill of materials.",
            "items": {
              "$ref": "#/components/schemas/StockComponentInput"
            }
          }
        },
        "required": [
          "name"
        ]
      },
      "StockOpeningBatchInput": {
        "type": "object",
        "properties": {
          "batchName": {
            "type": "string",
            "description": "Batch name."
          },
          "godownName": {
            "type": "string",
            "description": "Godown name. Must exist in this company."
          },
          "name": {
            "type": "string",
            "description": "Tracking name of the batch line."
          },
          "manufacturingDate": {
            "type": "string",
            "format": "date",
            "description": "Manufacturing date, `YYYY-MM-DD`."
          },
          "expiryPeriod": {
            "type": "string",
            "description": "Expiry period, as Tally states it."
          },
          "quantity": {
            "type": "number",
            "description": "Quantity."
          },
          "rate": {
            "type": "number",
            "description": "Rate."
          },
          "value": {
            "type": "number",
            "description": "Value."
          }
        }
      },
      "TdsAllocationInput": {
        "type": "object",
        "properties": {
          "natureOfPayment": {
            "type": "string",
            "description": "Name of a TDS or TCS rate from `GET /v1/tds-rates`."
          },
          "assessableValue": {
            "type": [
              "number",
              "null"
            ],
            "description": "Assessable value. For classification only, never added to any total."
          }
        },
        "required": [
          "natureOfPayment"
        ]
      },
      "TdsCategoryDetail": {
        "type": "object",
        "properties": {
          "applicableFrom": {
            "type": "string",
            "format": "date",
            "description": "Effective date, `YYYY-MM-DD`."
          },
          "tdsRateSection": {
            "type": "string"
          },
          "tdsRateChallanCode": {
            "type": "string"
          },
          "rateOfTax": {
            "type": "number"
          },
          "otherRate": {
            "type": "number"
          },
          "noPanRateOfTax": {
            "type": "number"
          },
          "exemptionLimit": {
            "type": "number"
          },
          "singleBillValue": {
            "type": "number"
          }
        }
      },
      "TdsDeductionRow": {
        "type": "object",
        "properties": {
          "voucherNumber": {
            "type": "string"
          },
          "voucherDate": {
            "type": "string",
            "format": "date"
          },
          "partyLedger": {
            "type": "string"
          },
          "partyPan": {
            "type": "string"
          },
          "taxType": {
            "type": "string",
            "description": "Tax type."
          },
          "category": {
            "type": "string",
            "description": "Nature of payment / TdsRate master name."
          },
          "section": {
            "type": "string"
          },
          "deducteeType": {
            "type": "string"
          },
          "dutyLedger": {
            "type": "string"
          },
          "assessableAmount": {
            "type": "number"
          },
          "taxRate": {
            "type": "number"
          },
          "taxAmount": {
            "type": "number"
          }
        }
      },
      "TdsDeductionsReport": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "pageSize": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TdsDeductionRow"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/TdsDeductionsSummary"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the period exceeded the report row cap and these totals are incomplete."
          }
        }
      },
      "TdsDeductionsSummary": {
        "type": "object",
        "properties": {
          "totalAssessable": {
            "type": "number",
            "description": "Sum of assessable amounts for the whole period, not only this page."
          },
          "totalTax": {
            "type": "number",
            "description": "Sum of tax for the whole period, not only this page."
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "TrialBalance": {
        "type": "object",
        "properties": {
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReportLine"
            }
          },
          "totalDebit": {
            "type": "number"
          },
          "totalCredit": {
            "type": "number"
          }
        },
        "required": [
          "from",
          "to",
          "lines",
          "totalDebit",
          "totalCredit"
        ]
      },
      "UnitAlterRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/UnitInput"
          },
          {
            "type": "object",
            "properties": {}
          }
        ]
      },
      "UnitInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Unit symbol, for example `Nos`. No digits and no spaces."
          },
          "formalName": {
            "type": "string",
            "description": "Formal name, for example `Numbers`. No digits and no spaces, and different from `name`."
          },
          "baseUnit": {
            "type": "string",
            "description": "For a compound unit, its base unit. Must exist in this company."
          },
          "additionalUnits": {
            "type": "string",
            "description": "For a compound unit, its second unit. Must exist in this company."
          },
          "uqc": {
            "type": "string",
            "description": "GST Unit Quantity Code."
          },
          "decimalPlaces": {
            "type": "integer",
            "description": "Decimal places."
          },
          "conversion": {
            "type": "number",
            "description": "For a compound unit, the conversion factor."
          }
        },
        "required": [
          "name"
        ]
      },
      "UnitOfAttendanceInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Unit symbol."
          },
          "formalName": {
            "type": "string",
            "description": "Formal name."
          }
        },
        "required": [
          "name"
        ]
      },
      "UntrackedLine": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number",
            "description": "Signed, same convention as everything else here."
          },
          "asOfDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The party's last ledger movement date; null when it could not be read."
          },
          "overdueDays": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Null when the date could not be read."
          }
        },
        "required": [
          "amount",
          "asOfDate",
          "overdueDays"
        ]
      },
      "Voucher": {
        "type": "object",
        "properties": {
          "voucherNumber": {
            "type": "string"
          },
          "guid": {
            "type": "string"
          },
          "masterId": {
            "type": "integer",
            "format": "int64",
            "description": "Tally's numeric id for the voucher."
          },
          "alterId": {
            "type": "integer",
            "format": "int64",
            "description": "Tally's alteration counter. It rises each time the voucher changes."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "voucherType": {
            "type": "string"
          },
          "partyName": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "description": "Voucher reference. For an order, this is its order number."
          },
          "narration": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "description": "Voucher amount. May arrive as a string, so parse it."
          },
          "ledgerEntries": {
            "type": "array",
            "description": "Ledger lines.",
            "items": {
              "$ref": "#/components/schemas/VoucherLedgerEntry"
            }
          },
          "inventoryEntries": {
            "type": "array",
            "description": "Stock lines.",
            "items": {
              "$ref": "#/components/schemas/VoucherInventoryEntry"
            }
          },
          "placeOfSupply": {
            "type": [
              "string",
              "null"
            ],
            "description": "GST place of supply."
          },
          "partyGstin": {
            "type": [
              "string",
              "null"
            ],
            "description": "Party GSTIN on this voucher."
          },
          "gstRegistrationType": {
            "type": [
              "string",
              "null"
            ],
            "description": "GST registration type."
          },
          "dispatch": {
            "$ref": "#/components/schemas/DispatchDetails"
          },
          "consignee": {
            "$ref": "#/components/schemas/ConsigneeDetails"
          },
          "irn": {
            "type": [
              "string",
              "null"
            ],
            "description": "E-invoice IRN."
          },
          "ewayBillNo": {
            "type": [
              "string",
              "null"
            ],
            "description": "First e-way bill number."
          },
          "isCancelled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "`true` if cancelled."
          },
          "eInvoice": {
            "$ref": "#/components/schemas/EInvoiceDetails"
          },
          "ewayBills": {
            "type": [
              "array",
              "null"
            ],
            "description": "E-way bills.",
            "items": {
              "$ref": "#/components/schemas/EwayBill"
            }
          }
        }
      },
      "VoucherDryRunResult": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "Always `true` here."
          },
          "dryRun": {
            "type": "boolean",
            "description": "Always `true` here."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "checked",
              "skipped_no_company"
            ],
            "description": "`checked` when you sent `companyGuid` and every name resolved. `skipped_no_company` when you did not, so only the arithmetic was checked."
          },
          "resolved": {
            "type": "object",
            "description": "The voucher as it would post, with names spelled as your books spell them and the party filled in."
          },
          "warnings": {
            "type": "array",
            "description": "Things worth a look that do not stop the write. Present only when there are some.",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "party_group_unusual",
                    "unknown_bill_reference",
                    "characters_tally_cannot_store",
                    "tds_nature_unverifiable"
                  ],
                  "description": "Warning code."
                },
                "field": {
                  "type": "string",
                  "description": "The field it concerns."
                },
                "message": {
                  "type": "string",
                  "description": "What to check."
                }
              },
              "required": [
                "code",
                "message"
              ]
            }
          },
          "gates": {
            "type": "array",
            "description": "Refusals this voucher would hit on commit. A dry run reports them and still returns 200.",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "expense-equals-party",
                    "over-threshold",
                    "duplicate-bill"
                  ],
                  "description": "Refusal code. Send it in `acknowledge` to waive it."
                },
                "message": {
                  "type": "string",
                  "description": "What was found."
                }
              },
              "required": [
                "code",
                "message"
              ]
            }
          },
          "numbering": {
            "type": "object",
            "description": "The number this voucher would get. Present only when AutoTally would allocate one.",
            "properties": {
              "method": {
                "type": "string",
                "description": "The voucher type's numbering method."
              },
              "willBe": {
                "type": "string",
                "description": "The number the commit would claim."
              },
              "basis": {
                "type": "string",
                "description": "The series being continued, in words you can show a person."
              },
              "ignored": {
                "type": "array",
                "description": "Existing numbers set aside as out of series.",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "method",
              "willBe",
              "basis"
            ]
          },
          "findings": {
            "type": "array",
            "description": "What your company's own Tally settings say this voucher needs, such as a batch on a batch-tracked item. Present only when there are some. The dry run still passes. On commit, a finding with severity `error` refuses the voucher with 400 `invalid_voucher`, and nothing can waive it. A warning never stops a write.",
            "items": {
              "type": "object",
              "properties": {
                "ruleId": {
                  "type": "string",
                  "description": "The check that found it."
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "error",
                    "warning",
                    "info"
                  ],
                  "description": "`error` is what Tally would refuse, `warning` does not stop the write, `info` is for your information."
                },
                "path": {
                  "type": "string",
                  "description": "Where in the voucher, for example `inventoryEntries[1].batchAllocations`."
                },
                "message": {
                  "type": "string",
                  "description": "What was found."
                },
                "fix": {
                  "type": "string",
                  "description": "What to change."
                },
                "confirmed": {
                  "type": "boolean",
                  "description": "`false` when a setting this check needs has not been read from Tally yet, so it could not be confirmed."
                }
              },
              "required": [
                "ruleId",
                "severity",
                "path",
                "message",
                "fix",
                "confirmed"
              ]
            }
          }
        },
        "required": [
          "valid",
          "dryRun",
          "resolution"
        ]
      },
      "VoucherInput": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "Voucher date, `YYYY-MM-DD`."
          },
          "voucherNumber": {
            "type": "string",
            "description": "Your own voucher number. Send it from your system if you intend to retry: see [retries](#retrying-a-voucher). When the voucher type does not number imported vouchers and you omit this, AutoTally continues the series from your books, and refuses if it cannot."
          },
          "voucherType": {
            "type": "string",
            "description": "Name of a voucher type in this company, for example `Sales`. A type you created under a standard type follows the rules of its parent. The [rules by type](#rules-by-voucher-type) list what each one needs."
          },
          "narration": {
            "type": "string",
            "description": "Free text."
          },
          "ledgerEntries": {
            "type": "array",
            "description": "The ledger lines. Positive is debit, negative is credit.",
            "items": {
              "$ref": "#/components/schemas/LedgerEntryInput"
            }
          },
          "inventoryEntries": {
            "type": "array",
            "description": "Stock lines. Required for orders and stock vouchers, and for an item invoice. On an item invoice, ledger lines plus stock lines plus additional charges must net to zero.",
            "items": {
              "$ref": "#/components/schemas/InventoryEntryInput"
            }
          },
          "placeOfSupply": {
            "type": "string",
            "description": "GST place of supply, as a state name."
          },
          "partyGstin": {
            "type": "string",
            "description": "Party GSTIN for this voucher, overriding the party ledger."
          },
          "gstRegistrationType": {
            "type": "string",
            "description": "Party registration type for this voucher, for example `Regular` or `Unregistered`."
          },
          "additionalCharges": {
            "type": "array",
            "description": "Charges on the whole invoice, such as freight or packing. Signed like a ledger line and included in the net-to-zero check.",
            "items": {
              "$ref": "#/components/schemas/AdditionalChargeInput"
            }
          },
          "originalInvoiceRef": {
            "type": "string",
            "description": "The invoice this note is raised against. Required for Debit Note and Credit Note. It posts as an `Agst Ref` bill allocation on the first ledger line."
          },
          "orderNumber": {
            "type": "string",
            "description": "The order's own number. Required for Sales Order and Purchase Order. On a read it comes back as `reference`."
          },
          "orderDueDate": {
            "type": "string",
            "format": "date",
            "description": "Order due date, `YYYY-MM-DD`."
          }
        },
        "required": [
          "date",
          "voucherType"
        ]
      },
      "VoucherInventoryEntry": {
        "type": "object",
        "properties": {
          "stockItemName": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "rate": {
            "type": "number"
          },
          "amount": {
            "type": "number"
          },
          "godown": {
            "type": "string"
          },
          "batchAllocations": {
            "type": "array",
            "description": "Stock by batch and godown.",
            "items": {
              "$ref": "#/components/schemas/BatchAllocation"
            }
          },
          "accountingLedger": {
            "type": "string"
          },
          "hsn": {
            "type": [
              "string",
              "null"
            ],
            "description": "HSN or SAC code."
          },
          "taxability": {
            "type": [
              "string",
              "null"
            ],
            "description": "Taxability."
          },
          "rateDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "One entry per duty head.",
            "items": {
              "$ref": "#/components/schemas/GstRateDetail"
            }
          },
          "gstHsnSacCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "HSN or SAC code."
          },
          "isReverseChargeApplicable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Reverse charge applies."
          },
          "forex": {
            "$ref": "#/components/schemas/Forex"
          },
          "forexRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit price in the foreign currency."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "Line description. Several lines are joined with a newline."
          },
          "discountPercent": {
            "type": [
              "number",
              "null"
            ],
            "description": "Discount percent. `0` on a line with no discount."
          },
          "actualQuantity": {
            "type": [
              "number",
              "null"
            ],
            "description": "Actual quantity, which can differ from the billed `quantity`."
          },
          "rateUnit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Unit the rate is per, for example `Pcs`."
          },
          "mfgDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Manufacturing date, when every batch on the line shares one."
          },
          "expiryDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Expiry date, when every batch on the line shares one."
          }
        }
      },
      "VoucherLedgerEntry": {
        "type": "object",
        "properties": {
          "ledgerName": {
            "type": "string",
            "description": "Ledger name."
          },
          "amount": {
            "type": "number",
            "description": "Signed amount: positive debit, negative credit."
          },
          "ledgerType": {
            "type": "string"
          },
          "isPartyLedger": {
            "type": "boolean"
          },
          "billAllocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillAllocation"
            }
          },
          "costCentreAllocations": {
            "type": [
              "array",
              "null"
            ],
            "description": "Cost centre split.",
            "items": {
              "$ref": "#/components/schemas/CostCentreAllocation"
            }
          },
          "bankAllocations": {
            "type": [
              "array",
              "null"
            ],
            "description": "Instrument details.",
            "items": {
              "$ref": "#/components/schemas/BankAllocation"
            }
          },
          "rateDetails": {
            "type": [
              "array",
              "null"
            ],
            "description": "One entry per duty head.",
            "items": {
              "$ref": "#/components/schemas/GstRateDetail"
            }
          },
          "hsn": {
            "type": [
              "string",
              "null"
            ],
            "description": "HSN or SAC code."
          },
          "taxability": {
            "type": [
              "string",
              "null"
            ],
            "description": "Taxability."
          },
          "gstHsnSacCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "HSN or SAC code."
          },
          "isReverseChargeApplicable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Reverse charge applies."
          },
          "forex": {
            "$ref": "#/components/schemas/Forex"
          }
        },
        "required": [
          "ledgerName",
          "amount"
        ]
      },
      "VoucherStatistic": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int64"
          },
          "cancelledCount": {
            "type": "integer",
            "format": "int64"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          },
          "optionalCount": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "WriteAccepted": {
        "type": "object",
        "properties": {
          "intentId": {
            "type": "string",
            "format": "uuid",
            "description": "Poll `GET /v1/intents/{id}` with this."
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "claimed",
              "submitted",
              "applied",
              "failed",
              "rejected"
            ],
            "description": "State of the write."
          },
          "deduped": {
            "type": "boolean",
            "description": "`true` if this returned an earlier write instead of queuing a new one."
          }
        },
        "required": [
          "intentId",
          "state",
          "deduped"
        ]
      }
    }
  }
}
