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

# Start an upload

> Open an upload session and return a presigned URL for every part.

`sizeBytes` must be exact: it fixes the part size and part count for the
life of the session, and a wrong value is not detected until assembly fails.
Split the file on exactly `partSize` and PUT each part to its own URL,
keeping the `ETag` each one returns. Bytes go straight to storage and never
through this API.

A small file is a one-part upload rather than a separate code path, so there
is one flow to implement at every size.



## OpenAPI

````yaml https://api.vaquill.ai/workspace/openapi/v1.json post /v1/uploads
openapi: 3.1.0
info:
  title: Vaquill Legal Workspace API
  description: >-
    Organization-scoped API for driving your legal workspace from your own
    backend: matters, documents, drafting, review, compare and matrices.


    **Authentication**: `Authorization: Bearer vq_ws_...`. Credentials are
    issued by an organization owner from the automation console at `/automation`
    and are shown once. The organization is resolved from the credential and can
    never be named in a request, so there is no `organizationId` field anywhere
    in this API and sending one is refused.


    This is NOT the Vaquill Data API. That one holds a `vq_key_` credential and
    serves the public legal corpus; the two share no credential, host or
    endpoint, and sending a `vq_key_` here is refused with an error naming the
    other product.


    ## Long-running work


    Anything that costs real work answers `202` with an **operation**. Poll `GET
    /v1/operations/{operationId}` until `status` is `succeeded`, `failed` or
    `cancelled`, honouring `Retry-After` between polls. There are no webhooks,
    so polling is the only completion signal. The five statuses are `queued`,
    `running`, `succeeded`, `failed`, `cancelled`, and there is no sixth: every
    capability reports through the same envelope.


    Send an `Idempotency-Key` on any launch. A retry with the same key and the
    same body returns the FIRST operation rather than starting a second billable
    job, which is what makes recovering from a timeout free.


    ## Identifiers


    Every public id is `<prefix>_<32 lowercase hex>`, for example
    `mat_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6`. The prefix names the resource type.
    Ids are opaque: take them from responses rather than building them, and
    never pass a bare database uuid.


    ## Lists


    Every collection answers `{data, pagination}`, never a bare array. Page with
    `limit` and `offset`, and read `pagination.total` to size a job before
    running it. `pagination.hasMore` is the reliable signal that rows remain.


    ## Errors


    Errors are RFC 9457 problem documents (`application/problem+json`),
    including for a wrong path and a wrong method. Branch on `type`; it is the
    stable identifier and it resolves to a page describing the failure. `title`
    and `detail` are written for people and may be reworded at any time. Every
    response carries `X-Request-ID`, and every error repeats it as `requestId`:
    quote it when contacting support.


    A `404` is returned identically for a resource that does not exist, one
    belonging to another organization, and one outside your installation's
    matter allowlist. That is deliberate, so the status code cannot be used to
    discover which ids exist elsewhere.


    ## Rate limits


    Limits are per credential and are set by what an operation COSTS rather than
    by its HTTP method, so a `GET` that runs a retrieval is not a read. Each
    operation's tier is fixed; a `429` carries `Retry-After`.


    | Tier | Per minute | Per hour | Per day |

    |---|---|---|---|

    | `poll` | 120 | 3000 | 30000 |

    | `read` | 60 | 1200 | 15000 |

    | `write` | 30 | 600 | 5000 |

    | `launch` | 10 | 200 | 2000 |

    | `download` | 20 | 300 | 3000 |

    | `upload` | 5 | 100 | 500 |


    ## Scopes


    A credential carries an explicit scope set, chosen when it is issued. A call
    outside them is `403` with `insufficient-scope`, naming the scopes the
    operation needed. Read and run are separate throughout, so a credential can
    be allowed to read results without being allowed to spend money producing
    them.


    `chronology:read`, `chronology:write`, `clients:read`, `clients:write`,
    `compare:read`, `compare:run`, `compliance:read`, `compliance:run`,
    `credentials:rotate`, `documents:download`, `documents:read`,
    `documents:write`, `drafting:read`, `drafting:run`, `exports:create`,
    `exports:read`, `facts:read`, `facts:run`, `matrices:read`, `matrices:run`,
    `matrices:write`, `matters:read`, `matters:write`, `nda:read`, `nda:run`,
    `operations:read`, `playbooks:read`, `playbooks:run`, `playbooks:write`,
    `research:read`, `research:run`, `review:read`, `review:run`,
    `summaries:read`, `summaries:run`, `webhooks:read`, `webhooks:write`,
    `workflows:read`, `workflows:run`, `workflows:write`
  version: 1.0.0
servers:
  - url: https://api.vaquill.ai/workspace
    description: Vaquill Legal Workspace API (production)
  - url: /workspace
    description: Vaquill Legal Workspace API (relative to the mount)
security:
  - WorkspaceAuth: []
tags:
  - name: Operations
    description: >-
      The one job envelope. Every long-running call answers `202` with an
      operation, and polling this resource is the only way to learn it finished:
      there are no webhooks. Five statuses, no synonyms.
  - name: Clients
    description: The people and companies matters are filed under. Synchronous CRUD.
  - name: Matters
    description: >-
      The unit of work everything else hangs off. A matter scopes documents,
      drafts, reviews, comparisons and matrices, and it is what a credential's
      access is checked against.
  - name: Folders
    description: >-
      Organization inside and across matters. The same folders the web app
      shows, so one created here appears in the customer's browser.
  - name: Documents
    description: >-
      Files in a matter: their metadata, their ingested text, and the original
      bytes. A document is only usable by retrieval, drafting and review once
      its status is `succeeded`.
  - name: Uploads
    description: >-
      Getting files in. One presigned multipart flow at every size, with the
      bytes going straight to storage and never through this API. Initiate, PUT
      each part, then complete.
  - name: Research
    description: >-
      Asking legal questions and getting grounded, cited answers. This API does
      NOT stream: an ask answers `202` and you poll the operation, then read the
      answer off the message it points at. Conversation state is kept here, so
      you hold a chat id rather than replaying a transcript. Also covers the
      matter settings behind an answer, the skills you can ask through, and the
      standalone web-research tools.
  - name: Drafting
    description: >-
      Generating, revising and exporting draft documents. Bodies come out as
      sections and go in as markdown; the editor's own format is never on the
      wire. Rendered files come from the export route.
  - name: Playbooks
    description: >-
      The organization's negotiating positions, per contract type, and the
      starter templates to build them from. A playbook is the input a contract
      review is measured against.
  - name: Reviews
    description: >-
      Reviewing one contract against a playbook: clause analysis, redlines,
      flags, liability exposure and a reported sign-off gate. Export applies the
      redlines as native Word tracked changes.
  - name: Facts
    description: >-
      The cross-document fact ledger for a matter: what every document in it
      asserts, coalesced and cited back to its source passages.
  - name: Matter summary
    description: >-
      A citation-backed summary of everything filed to a matter, generated on
      demand and readable claim by claim.
  - name: Chronology
    description: >-
      The dated events across a matter's documents, as one timeline, with
      duplicate and date-conflict flags.
  - name: NDA triage
    description: >-
      Screening one inbound NDA against ten standard criteria and, where you
      name one, your own NDA playbook. Answers `green`, `yellow` or `red` with
      the reasoning per criterion, plus a report you can forward.
  - name: Compliance
    description: >-
      Checking one document against one regulation's requirement checklist: a
      verdict per requirement with the article it comes from, the gaps, and what
      to do about them. Only regulations with a real checklist behind them are
      accepted.
  - name: Comparisons
    description: >-
      Diffing two documents in a matter into structural changes, with a
      substantive-versus-cosmetic judgment and a downloadable redline.
  - name: Matrices
    description: >-
      Spreadsheet-style extraction across many documents: rows are documents,
      columns are questions, cells are answers with verified citations. Building
      a grid is free; running it is what costs.
  - name: Workflows
    description: >-
      Multi-step analyses from a fixed catalogue. Read a definition to learn
      what documents and inputs it takes, launch a run inside a matter, then
      download the artifacts it produces.
externalDocs:
  description: Getting started guide and error reference
  url: https://vaquill.ai/docs/workspace-api
paths:
  /v1/uploads:
    post:
      tags:
        - Uploads
      summary: Start an upload
      description: >-
        Open an upload session and return a presigned URL for every part.


        `sizeBytes` must be exact: it fixes the part size and part count for the

        life of the session, and a wrong value is not detected until assembly
        fails.

        Split the file on exactly `partSize` and PUT each part to its own URL,

        keeping the `ETag` each one returns. Bytes go straight to storage and
        never

        through this API.


        A small file is a one-part upload rather than a separate code path, so
        there

        is one flow to implement at every size.
      operationId: uploads.initiate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadInitiateRequest'
            example:
              matterId: mat_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
              filename: msa-acme-v3.docx
              contentType: application/pdf
              sizeBytes: 248193
              folderId: fld_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
              handwritten: false
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadSession'
              example:
                uploadId: upl_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
                partSize: 5242880
                totalParts: 3
                parts:
                  - partNumber: 1
                    url: >-
                      https://storage.vaquill.ai/exports/msa-acme-v3-redline.docx?signature=...
                    expiresAt: '2026-08-19T14:32:10Z'
                expiresAt: '2026-08-19T14:32:10Z'
        '401':
          description: >-
            The credential is missing, malformed, unknown, revoked or expired.
            `type` is `invalid-credential`, or `wrong-product-credential` when a
            `vq_key_` Data API key was sent to this API.
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
            WWW-Authenticate:
              description: RFC 9110 authentication challenge.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: >-
            The credential does not carry a scope this operation requires
            (`insufficient-scope`), or the organization's installation is
            suspended (`installation-inactive`).
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
            WWW-Authenticate:
              description: RFC 9110 authentication challenge.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '422':
          description: >-
            The request does not match the published schema. `errors` names each
            rejected field and why. The submitted value is never echoed back.
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationProblem'
        '429':
          description: Too many requests for this credential's tier. Honour `Retry-After`.
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '500':
          description: >-
            An unexpected error on our side. The body carries a stable `type`
            and the request id and nothing else; the cause is in our logs.
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '503':
          description: >-
            A dependency this request needs is unavailable, so nothing was done.
            Retryable. Authentication fails closed rather than admitting the
            request, so this is never a statement about your credential.
          headers:
            X-Request-ID:
              description: >-
                The id of this request. The same value appears as `requestId` in
                the body. Quote it when contacting support.
              schema:
                type: string
                examples:
                  - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
components:
  schemas:
    UploadInitiateRequest:
      properties:
        matterId:
          type: string
          title: Matterid
          description: >-
            `mat_` identifier of the matter to upload into. Must belong to your
            organization.
          examples:
            - mat_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        filename:
          type: string
          maxLength: 255
          minLength: 1
          title: Filename
          description: >-
            Filename to store, including its extension. Trimmed; whitespace
            alone is refused. This exact string is used to build the stored
            object, so it cannot be changed afterwards.
          examples:
            - msa-acme-v3.docx
        contentType:
          type: string
          maxLength: 255
          minLength: 1
          title: Contenttype
          description: >-
            IANA media type of the file, for example `application/pdf`. Must be
            on the supported list or the request is refused before any URL is
            signed.
          examples:
            - application/pdf
        sizeBytes:
          type: integer
          maximum: 2147483648
          exclusiveMinimum: 0
          title: Sizebytes
          description: >-
            Exact size of the file in bytes. Not advisory: it fixes the part
            size and part count for the life of the session, and a wrong value
            fails at complete time. Must be greater than zero.
          examples:
            - 248193
        folderId:
          anyOf:
            - type: string
            - type: 'null'
          title: Folderid
          description: >-
            `fld_` identifier to file the document under on the way in. Saves a
            second call. Must belong to your organization.
          examples:
            - fld_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        handwritten:
          type: boolean
          title: Handwritten
          description: >-
            Set true for scanned or handwritten pages to route the file through
            vision OCR instead of the text-layer reader. Leaving it false on a
            scanned exhibit ingests it badly.
          default: false
          examples:
            - false
      additionalProperties: false
      type: object
      required:
        - matterId
        - filename
        - contentType
        - sizeBytes
      title: UploadInitiateRequest
      description: >-
        Ask for somewhere to put a file.


        `sizeBytes` is required and is not advisory: it decides the part size
        and

        the part count, both of which are fixed for the life of the session. R2

        cannot be asked to assemble parts it was not told to expect, so a size
        that

        turns out to be wrong fails at complete time rather than corrupting a

        document.
    UploadSession:
      properties:
        uploadId:
          type: string
          title: Uploadid
          description: >-
            Public identifier for this upload session, `upl_` followed by 32 hex
            characters. Use it to presign a part and to complete the upload.
          examples:
            - upl_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        partSize:
          type: integer
          title: Partsize
          description: >-
            Size in bytes of every part except the last. Split the file on
            exactly this boundary or the assembled object will not match.
          examples:
            - 5242880
        totalParts:
          type: integer
          title: Totalparts
          description: >-
            How many parts to upload. Always at least 1: a small file is a
            one-part upload rather than a separate code path.
          examples:
            - 3
        parts:
          items:
            $ref: '#/components/schemas/UploadPartLink'
          type: array
          title: Parts
          description: One presigned URL per part, in order.
        expiresAt:
          type: string
          format: date-time
          title: Expiresat
          description: >-
            When the whole SESSION expires (RFC 3339), which is much later than
            any individual part URL. Past this, storage discards the parts and
            the upload has to start again.
          examples:
            - '2026-08-19T14:32:10Z'
      additionalProperties: false
      type: object
      required:
        - uploadId
        - partSize
        - totalParts
        - parts
        - expiresAt
      title: UploadSession
      description: >-
        An open upload, and every URL needed to fill it.


        Two things are deliberately not here.


        The R2 object KEY. It is inside each presigned URL and cannot not be,
        since

        an S3 presigned URL is a signed PATH. What is refused is publishing it
        as a

        FIELD: a field is a stable, structured handle a client would build on
        and we

        could never withdraw, whereas the URL is a fifteen-minute capability for
        one

        object the caller was already granted. Nothing cross-tenant is disclosed

        either way; the uuids in that path are the caller's own.


        The DOCUMENT ID. There is no document until the bytes land, only an

        intention to create one, and publishing an id for a row that may never
        be

        filled invites a customer to store it and then poll something that never

        starts. It arrives on the operation's `resource` at complete time, which
        is

        the first moment it means anything.
    Problem:
      type: object
      title: Problem
      description: >-
        An RFC 9457 problem document. Branch on `type`, which is stable; `title`
        and `detail` are written for people and may be reworded. Some problems
        carry extra members (`requiredScopes`, `limit`, `expectedVersion`),
        which is why this object is open.
      required:
        - type
        - title
        - status
        - detail
        - instance
      properties:
        type:
          type: string
          format: uri
          description: >-
            The stable identifier for this error, and the one field to branch
            on. Resolves to a page describing it.
          examples:
            - https://vaquill.ai/docs/workspace-api/errors/insufficient-scope
        title:
          type: string
          description: A short human-readable summary.
          examples:
            - Insufficient scope
        status:
          type: integer
          description: The HTTP status code, repeated.
          examples:
            - 403
        detail:
          type: string
          description: >-
            What went wrong on this specific request. May be reworded at any
            time.
          examples:
            - >-
              This credential carries matters:read. This operation needs
              matters:write.
        instance:
          type: string
          description: The path this problem occurred on.
          examples:
            - /workspace/v1/matters/mat_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        requestId:
          type: string
          description: >-
            The id of this request, identical to the `X-Request-ID` response
            header. Quote it when contacting support.
          examples:
            - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
      additionalProperties: true
    ValidationProblem:
      type: object
      title: ValidationProblem
      description: >-
        A problem document for a schema rejection. `errors` lists the fields
        that were refused. The value you submitted is deliberately not echoed,
        so a validation failure cannot copy your content into an error response
        or into either side's logs.
      required:
        - type
        - title
        - status
        - detail
        - instance
        - errors
      properties:
        type:
          type: string
          format: uri
          description: >-
            The stable identifier for this error, and the one field to branch
            on. Resolves to a page describing it.
          examples:
            - https://vaquill.ai/docs/workspace-api/errors/insufficient-scope
        title:
          type: string
          description: A short human-readable summary.
          examples:
            - Insufficient scope
        status:
          type: integer
          description: The HTTP status code, repeated.
          examples:
            - 403
        detail:
          type: string
          description: >-
            What went wrong on this specific request. May be reworded at any
            time.
          examples:
            - >-
              This credential carries matters:read. This operation needs
              matters:write.
        instance:
          type: string
          description: The path this problem occurred on.
          examples:
            - /workspace/v1/matters/mat_9f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        requestId:
          type: string
          description: >-
            The id of this request, identical to the `X-Request-ID` response
            header. Quote it when contacting support.
          examples:
            - req_5f2c8b1e4a7d43c9b6e0f1a2c3d4e5f6
        errors:
          type: array
          description: One entry per rejected field.
          items:
            type: object
            required:
              - location
              - message
              - type
            properties:
              location:
                type: string
                description: >-
                  Dotted path to the rejected field, for example
                  `body.contentMarkdown`.
              message:
                type: string
                description: Why it was rejected.
              type:
                type: string
                description: The validation rule that failed.
      additionalProperties: true
    UploadPartLink:
      properties:
        partNumber:
          type: integer
          minimum: 1
          title: Partnumber
          description: >-
            Which part this URL is for. Parts are numbered from 1 and must be
            uploaded under the number given here.
          examples:
            - 1
        url:
          type: string
          title: Url
          description: >-
            Presigned URL to `PUT` this part's bytes to, directly to storage. No
            bytes pass through the Vaquill API. Keep the `ETag` the response
            returns.
          examples:
            - >-
              https://storage.vaquill.ai/exports/msa-acme-v3-redline.docx?signature=...
        expiresAt:
          type: string
          format: date-time
          title: Expiresat
          description: >-
            When this part URL stops working (RFC 3339). Re-sign an expired part
            with `uploads.presignPart`; parts already uploaded stay valid.
          examples:
            - '2026-08-19T14:32:10Z'
      additionalProperties: false
      type: object
      required:
        - partNumber
        - url
        - expiresAt
      title: UploadPartLink
      description: >-
        Where to PUT one part, and how long that stays true.


        `expiresAt` is on every part rather than on the session, because a large

        upload outlives a single signature: a client re-signs the parts it has
        not

        finished through `uploads.presignPart` and keeps the ones it has.
  securitySchemes:
    WorkspaceAuth:
      type: http
      scheme: bearer
      bearerFormat: vq_ws_*
      description: >-
        Workspace credential issued from the automation console at
        `/automation`. Send it as `Authorization: Bearer vq_ws_...`. This is NOT
        a Data API key: a `vq_key_` credential is refused here and names the
        other product in the error.

````