---
title: "POST /v1/{+database}/documents:executePipeline"
method: POST
path: "/v1/{+database}/documents:executePipeline"
tags: ["projects"]
---

# POST /v1/{+database}/documents:executePipeline

`POST /v1/{+database}/documents:executePipeline`

Executes a pipeline query.

## Path parameters

- `database` string, required

## Request body

- ExecutePipelineRequest — The request for Firestore.ExecutePipeline.
  - `requestOptions` RequestOptions — Options for a server request.
    - `requestTags` string[] — Optional. The request tags for the request.
  - `autoCommitTransaction` boolean — Optional. Automatically commits the transaction after the pipeline has been executed. Only permitted in combination with `transaction` or `new_transaction`.
  - `transaction` string, byte — Run the query within an already active transaction. The value here is the opaque transaction ID to execute the query in.
  - `newTransaction` TransactionOptions — Options for creating a new transaction.
    - `readOnly` ReadOnly — Options for a transaction that can only be used to read documents.
      - `readTime` string, google-datetime — Reads documents at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days.
    - `readWrite` ReadWrite — Options for a transaction that can be used to read and write documents.
      - `concurrencyMode` 'CONCURRENCY_MODE_UNSPECIFIED' | 'OPTIMISTIC' | 'PESSIMISTIC' — Optional. The concurrency control mode to use for this transaction. A database is able to use different concurrency modes for different transactions simultaneously. 3rd party auth requests are only allowed to create optimistic read-write transactions and must specify that here even if the database-level setting is already configured to optimistic.
      - `retryTransaction` string, byte — An optional transaction to retry.
  - `readTime` string, google-datetime — Execute the pipeline in a snapshot transaction at the given time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days.
  - `structuredPipeline` StructuredPipeline — A Firestore query represented as an ordered list of operations / stages. This is considered the top-level function which plans and executes a query. It is logically equivalent to `query(stages, options)`, but prevents the client from having to build a function wrapper.
    - `pipeline` Pipeline — A Firestore query represented as an ordered list of operations / stages.
      - `stages` Stage[] — Required. Ordered list of stages to evaluate.
        - `name` string — Required. The name of the stage to evaluate. **Requires:** * must be in snake case (lower case with underscore separator).
        - `args` Value[] — Optional. Ordered list of arguments the given stage expects.
          - `timestampValue` string, google-datetime — A timestamp value. Precise only to microseconds. When stored, any additional precision is rounded down.
          - `pipelineValue` Pipeline — recursive
          - `booleanValue` boolean — A boolean value.
          - `geoPointValue` LatLng — An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
            - `latitude` number, double — The latitude in degrees. It must be in the range [-90.0, +90.0].
            - `longitude` number, double — The longitude in degrees. It must be in the range [-180.0, +180.0].
          - `functionValue` Function — Represents an unevaluated scalar expression. For example, the expression `like(user_name, "%alice%")` is represented as: ``` name: "like" args { field_reference: "user_name" } args { string_value: "%alice%" } ```
            - `name` string — Required. The name of the function to evaluate. **Requires:** * must be in snake case (lower case with underscore separator).
            - `args` Value[] — Optional. Ordered list of arguments the given function expects.
            - `options` object — Optional. Optional named arguments that certain functions may support.
          - `variableReferenceValue` string — Pointer to a variable defined elsewhere in a pipeline. Unlike `field_reference_value` which references a field within a document, this refers to a variable, defined in a separate namespace than the fields of a document.
          - `arrayValue` ArrayValue — An array value.
            - `values` Value[] — Values in the array.
          - `fieldReferenceValue` string — Value which references a field. This is considered relative (vs absolute) since it only refers to a field and not a field within a particular document. **Requires:** * Must follow field reference limitations. * Not allowed to be used when writing documents.
          - `bytesValue` string, byte — A bytes value. Must not exceed 1 MiB - 89 bytes. Only the first 1,500 bytes are considered by queries.
          - `stringValue` string — A string value. The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes. Only the first 1,500 bytes of the UTF-8 representation are considered by queries.
          - `mapValue` MapValue — A map value.
            - `fields` object — The map's fields. The map keys represent field names. Field names matching the regular expression `__.*__` are reserved. Reserved field names are forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be empty.
          - `integerValue` string, int64 — An integer value.
          - `doubleValue` number, double — A double value.
          - `nullValue` 'NULL_VALUE' — A null value.
          - `referenceValue` string — A reference to a document. For example: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
        - `options` object — Optional. Optional named arguments that certain functions may support.
    - `options` object — Optional. Optional query-level arguments.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/firestore.md) · [All operations](https://skmtc.net/google/apis/firestore/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/firestore/versions/11bc07a83431/schema)
