> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qubesync.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Discard a queued request

> Withdraws a request your app no longer wants, before the Web Connector picks it up: one that is `waiting`, or `retryable` between tries. It becomes `discarded`, is never sent to QuickBooks, and a webhook with that state goes to its `webhook_url`. The request itself stays, so it can still be retrieved. A request the Web Connector already has (`ticketed` or `sent`) goes ahead regardless, and one that has ended can't be discarded: both answer 409.



## OpenAPI

````yaml /api-reference/v2/openapi.json post /connections/{connection_id}/queued-requests/{id}/discard
openapi: 3.1.0
info:
  contact:
    email: support@qubesync.com
  description: >
    A single generic operation surface for every curated qbXML request QuBe Sync
    supports, driven directly off the qbXML schema -- see the [MCP
    server](/mcp-server) to explore available operations interactively.


    **Every endpoint queues a request and returns it immediately (`201`, a
    `QueuedRequest`).** QuickBooks Desktop is reached through the customer's Web
    Connector, which polls QuBe Sync, so the answer arrives seconds to minutes
    later. **Pass a `webhook_url` with every request**: when QuickBooks has
    answered, QuBe Sync POSTs the same document to it -- `state` set,
    `response_json` filled in -- signed with `X-QUBE-Signature` (see the
    Webhooks guide). `response_json` is the `{status, data}` envelope documented
    on each operation: `status: "success"` with `data` derived from the qbXML
    `*Ret` (and `warning`, QuickBooks' code and message, when it carried the
    request out but warned about it), or `status: "error"` with QuickBooks' own
    status code and message -- a QuickBooks business error is a *successful*
    HTTP round trip. `links.self` returns the request on demand (for a
    dashboard, a retry, a script); it is not the integration path. Send an
    `Idempotency-Key` header with each request so a call whose answer you never
    got can be sent again without queueing it twice.


    Authentication is HTTP Basic with your app's API key as the username and a
    blank password. Connections themselves (creating one, onboarding, its QWC
    file and password) are the `/connections` endpoints; every QuickBooks
    operation is scoped to one of them.
  title: QuBe Sync API (v2)
  version: 2.0.0
servers:
  - description: v2 API
    url: https://qubesync.com/api/v2
  - description: Local development server
    url: https://dev.qubesync.com/api/v2
security:
  - apiKey: []
tags:
  - description: >-
      Creating and managing the connection (a customer's QuickBooks company
      file) that every request below is queued against. See the Onboarding
      guide.
    name: Connections
  - description: >-
      Queueing qbXML you wrote yourself, listing the requests queued on a
      connection, and discarding one the app no longer wants. A `webhook_url` on
      each request is the integration path (see the Webhooks guide): the listing
      is for a dashboard, a script, or catching up after downtime.
    name: Queued Requests
  - description: >-
      Finding the record in a customer's company file that a name means, even
      written differently: ranked matches from QuBe Sync's index of the file's
      names, on realtime and simulated connections. See the Matching guide.
    name: Matching
  - description: >-
      Endpoints for publishing workflow definitions, starting runs, and
      answering a run that is waiting on a decision from your app. A workflow is
      one JSON statechart document; see the schema at
      /api/v2/workflows/schema.json.
    name: Workflows
  - name: Account Tax Line Infos
  - name: Accounts
  - name: Aging Reports
  - name: Alerts
  - name: Ar Refund Credit Cards
  - name: Bar Codes
  - name: Bill Payment Checks
  - name: Bill Payment Credit Cards
  - name: Bill To Pays
  - name: Billing Rates
  - name: Bills
  - name: Budget Summary Reports
  - name: Build Assemblies
  - name: Charges
  - name: Checks
  - name: Classes
  - name: Cleared Statuses
  - name: Companies
  - name: Company Activities
  - name: Credit Card Charges
  - name: Credit Card Credits
  - name: Credit Memos
  - name: Currencies
  - name: Custom Detail Reports
  - name: Custom Summary Reports
  - name: Customer Msgs
  - name: Customer Types
  - name: Customers
  - name: Data Event Recovery Infos
  - name: Data Ext Defs
  - name: Data Exts
  - name: Date Driven Terms
  - name: Deposits
  - name: Employee Defaults
  - name: Employees
  - name: Entities
  - name: Estimates
  - name: Form1099 Category Account Mappings
  - name: General Detail Reports
  - name: General Summary Reports
  - name: Hosts
  - name: Inventory Adjustments
  - name: Inventory Sites
  - name: Invoices
  - name: Item Assemblies Can Builds
  - name: Item Discounts
  - name: Item Fixed Assets
  - name: Item Groups
  - name: Item Inventories
  - name: Item Inventory Assemblies
  - name: Item Non Inventories
  - name: Item Other Charges
  - name: Item Payments
  - name: Item Receipts
  - name: Item Sales Tax Groups
  - name: Item Sales Taxes
  - name: Item Services
  - name: Item Sites
  - name: Item Subtotals
  - name: Items
  - name: Job Reports
  - name: Job Types
  - name: Journal Entries
  - name: Leads
  - name: List Deleteds
  - name: List Displays
  - name: List Merge
  - name: Lists
  - name: Other Names
  - name: Paychecks
  - name: Payment Methods
  - name: Payments
  - name: Payroll Detail Reports
  - name: Payroll Item Additions
  - name: Payroll Item Company Contributions
  - name: Payroll Item Deductions
  - name: Payroll Item Direct Deposits
  - name: Payroll Item Non Wages
  - name: Payroll Item Taxes
  - name: Payroll Item Wages
  - name: Payroll Item Workers Compensations
  - name: Payroll Items
  - name: Payroll Last Periods
  - name: Payroll Liability Adjustments
  - name: Payroll Liability Checks
  - name: Payroll Prior Payments
  - name: Payroll Summary Reports
  - name: Payroll Year To Date Adjustments
  - name: Preferences
  - name: Price Levels
  - name: Purchase Orders
  - name: Qb Command Exec
  - name: Receive Payment To Deposits
  - name: Receive Payments
  - name: Sales Orders
  - name: Sales Receipts
  - name: Sales Reps
  - name: Sales Tax Codes
  - name: Sales Tax Payables
  - name: Sales Tax Payment Checks
  - name: Sales Tax Return Lines
  - name: Sales Tax Returns
  - name: Ship Methods
  - name: Special Accounts
  - name: Special Items
  - name: Standard Terms
  - name: Templates
  - name: Terms
  - name: Time Reports
  - name: Time Trackings
  - name: To Dos
  - name: Transactions
  - name: Transfer Inventories
  - name: Transfers
  - name: Txn Deleteds
  - name: Txn Displays
  - name: Txn Void
  - name: Txns
  - name: Unit Of Measure Sets
  - name: Vehicle Mileages
  - name: Vehicles
  - name: Vendor Credits
  - name: Vendor Types
  - name: Vendors
  - name: Workers Comp Codes
paths:
  /connections/{connection_id}/queued-requests/{id}/discard:
    post:
      tags:
        - Queued Requests
      summary: Discard a queued request
      description: >-
        Withdraws a request your app no longer wants, before the Web Connector
        picks it up: one that is `waiting`, or `retryable` between tries. It
        becomes `discarded`, is never sent to QuickBooks, and a webhook with
        that state goes to its `webhook_url`. The request itself stays, so it
        can still be retrieved. A request the Web Connector already has
        (`ticketed` or `sent`) goes ahead regardless, and one that has ended
        can't be discarded: both answer 409.
      operationId: discardQueuedRequest
      parameters:
        - description: The connection to act on.
          in: path
          name: connection_id
          required: true
          schema:
            format: uuid
            type: string
        - description: The queued request.
          in: path
          name: id
          required: true
          schema:
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/QueuedRequest'
                type: object
          description: 'Discarded: the request, now `discarded`'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    enum:
                      - in_flight
                      - already_finished
                    type: string
                type: object
          description: >-
            `in_flight`: the Web Connector already has the request, so it goes
            ahead. `already_finished`: the request has already ended.
      security:
        - apiKey: []
components:
  schemas:
    QueuedRequest:
      properties:
        error:
          description: >-
            Set when `state` is `error`, `retryable`, `timed_out` or
            `discarded`. `error_type` says where it failed: for a `timed_out`
            request it is `timed_out`, and for a `discarded` one `discarded`,
            unless the request was `retryable` when your app discarded it, which
            keeps the connection error that held it up. `user_message` is safe
            to show an end user; `error_code` is QuickBooks' own status code for
            a business error, `hresult` the Web Connector's for a connection/XML
            error; `debug_message` is for you.
          properties:
            debug_message:
              description: Which element of the request the value came from, when known.
              type:
                - string
                - 'null'
            error_code:
              description: QuickBooks' statusCode, for a business error.
              type:
                - integer
                - 'null'
            error_type:
              description: >-
                `quickbooks_business_error`: QuickBooks refused the request --
                `response_json.error` has its code.
                `quickbooks_connection_error`: the Web Connector ran on the
                customer's PC but could not get the request into QuickBooks, so
                nothing was applied -- QuickBooks was not running, the company
                file was not open or not the one this connection belongs to, or
                a window or message box open in QuickBooks was in the way. Only
                the customer can fix that, and `user_message` tells them how.
                `xml_error`: QuickBooks could not parse the qbXML; sent again
                as-is, it fails again. `outcome_unknown`: a write the Web
                Connector answered with an error in place of QuickBooks' answer,
                so whether QuickBooks applied it is not known: look in
                QuickBooks before sending it again. `unexpected_error`: anything
                else; for a query, which changes nothing, sending it again is
                safe.


                `timed_out`: no answer came back -- the customer's computer lost
                its connection, or QuickBooks or the Web Connector was closed,
                while QuickBooks had the request. QuickBooks may still have
                applied it, so look before sending it again. `discarded`: your
                app discarded it before the Web Connector picked it up, so
                QuickBooks never got it. `response_too_large`: QuickBooks
                answered, but with more than QuBe Sync accepts for one answer (4
                MB as the Web Connector sends it, about 3 MB of qbXML), so the
                answer wasn't kept and `response_json` is null. QuickBooks ran
                the request. Page the query (`iterator` and a smaller
                `max_returned`), or narrow it when QuickBooks doesn't page it;
                for a write, look before sending it again.


                Web Connector problems on the customer's PC (its password, log
                file, the .QWC file) never reach QuBe Sync as an error: the Web
                Connector just stops calling in, and requests wait. Intuit's
                guide for those:
                https://quickbooks.intuit.com/learn-support/en-us/help-article/open-programs/fix-common-web-connector-errors-quickbooks-desktop/L9slolvg0_US_en_US
              enum:
                - xml_error
                - quickbooks_connection_error
                - quickbooks_business_error
                - unexpected_error
                - response_too_large
                - outcome_unknown
                - timed_out
                - discarded
              type: string
            hresult:
              description: >-
                The Web Connector's HRESULT (e.g. `0x80040400`), for a
                connection or XML error. Informational: branch on `error_type`,
                not on this.
              type:
                - string
                - 'null'
            message:
              description: >-
                The raw message from QuickBooks or the Web Connector; for
                `timed_out` and `discarded`, which neither sent, QuBe Sync's
                own.
              type: string
            user_message:
              description: A friendly message for the end user.
              type: string
          type:
            - object
            - 'null'
        id:
          description: Unique identifier for the queued request
          format: uuid
          type: string
        inserted_at:
          description: When the request was queued
          format: date-time
          type: string
        iteration_state:
          description: >-
            Whether this response is part of an ongoing iteration, and if so,
            whether more pages remain. Use this (not `state`) to tell whether a
            multi-page response is complete.
          enum:
            - not_applicable
            - continue
            - done
            - max_sandbox_iterations_reached
          type: string
        links:
          properties:
            connection_ui:
              format: uri
              type: string
            pages:
              description: >-
                The pages of a multi-page (iterated) response answered so far,
                oldest first, a page of them at a time (`page`, `page_size`),
                each with its own `iteration_state`. Each page is also delivered
                to `webhook_url` as it is answered.
              format: uri
              type: string
            self:
              description: >-
                This request, on demand (a dashboard link, a retry). The answer
                itself arrives at `webhook_url`.
              format: uri
              type: string
            ui:
              description: The request in the QuBe Sync dashboard.
              format: uri
              type: string
          required:
            - self
            - ui
            - connection_ui
            - pages
          type: object
        original_request_id:
          description: >-
            The id of the first page of this request's iteration. Equal to `id`
            on the first page itself.
          format: uuid
          type: string
        page:
          description: The page number, for a multi-page (iterated) response
          nullable: true
          type: integer
        request_types:
          description: The qbXML request type(s) compiled into this request
          items:
            type: string
          type: array
        request_xml:
          description: >-
            The qbXML sent to QuickBooks: compiled from the operation and its
            parameters, or as written for `POST
            /connections/{connection_id}/queued-requests`. A character above
            ASCII reaches QuickBooks as a character reference (`&#xE9;`).
          type: string
        response_json:
          description: QuBe Sync's summary of the answer, once the request is completed
          nullable: true
          type: object
        response_xml:
          description: >-
            The qbXML response from QuickBooks. One answer can be at most 4 MB
            as the Web Connector sends it, about 3 MB of qbXML; QuickBooks'
            answer over that isn't kept: this is null and `error.error_type` is
            `response_too_large`.
          nullable: true
          type: string
        state:
          description: >-
            `waiting`/`retryable`/`ticketed`/`sent` while the Web Connector is
            on its way; `response_received` once QuickBooks answered
            successfully (read `response_json.data`, and `response_json.warning`
            when QuickBooks warned about something it did); `error` when it did
            not -- the Web Connector could not reach QuickBooks, the qbXML was
            rejected, or QuickBooks answered with a business error such as 3100
            (then `error.error_type` is `quickbooks_business_error` and
            `response_json` still carries QuickBooks' own `{status: "error",
            error: {code, type, message}}`); `timed_out` when no answer came
            back (QuickBooks may still have applied it, so look before sending
            it again) and `discarded` when your app discarded it before the Web
            Connector picked it up. Both carry an `error`.
          enum:
            - waiting
            - retryable
            - ticketed
            - sent
            - response_received
            - error
            - timed_out
            - discarded
          type: string
        webhook_attempts:
          items:
            type: object
          type: array
        webhook_error:
          nullable: true
          type: string
        webhook_state:
          enum:
            - not_applicable
            - pending
            - succeeded
            - failed
          type: string
        webhook_url:
          format: uri
          nullable: true
          type: string
      required:
        - id
        - state
        - request_xml
        - links
      type: object
    Error:
      description: >-
        What a refused request answers with. The one key is errors, and its
        shape says what went wrong: a sentence when the endpoint explains the
        refusal in words (a parameter the operation does not take, a key already
        taken, a run that has already ended); an object with detail, and a code
        when there is one, when the request named nothing that exists or may not
        do what it asked (402, 403, 404, and a CLI session's 401), or an answer
        to a run's question was refused (the decisions endpoint's 400, 409 and
        422, which always carry a code to branch on); an object of fields, each
        a list of messages, when a record failed validation and nothing was
        saved; a list of {path, message} problems when a submitted document or
        input fails validation. A request without a usable API key gets a 401
        Basic challenge with the plain-text body Unauthorized, not JSON.
      properties:
        errors:
          oneOf:
            - example: 'unknown parameter: "emial"'
              title: A sentence
              type: string
            - properties:
                code:
                  example: read_only_session
                  type: string
                detail:
                  example: Not Found
                  type: string
              required:
                - detail
              title: Detail and code
              type: object
            - additionalProperties:
                items:
                  type: string
                type: array
              example:
                webhook_url:
                  - may not contain a username or password
              title: Field by field
              type: object
            - items:
                properties:
                  message:
                    example: is required
                    type: string
                  path:
                    example: input.customer
                    type: string
                required:
                  - path
                  - message
                type: object
              title: Located problems
              type: array
      required:
        - errors
      type: object
  responses:
    Unauthorized:
      content:
        text/plain:
          example: Unauthorized
          schema:
            type: string
      description: >-
        No usable API key. The key is Basic auth, so the answer is the
        challenge, with the plain-text body Unauthorized rather than JSON.
      headers:
        WWW-Authenticate:
          schema:
            example: Basic realm="Application"
            type: string
    NotFound:
      content:
        application/json:
          example:
            errors:
              detail: Not Found
          schema:
            $ref: '#/components/schemas/Error'
      description: Nothing by that id, or it belongs to another app.
  securitySchemes:
    apiKey:
      description: Use your app's API key as the username, and leave the password blank
      scheme: basic
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.