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

# List batch predictions

> Returns batch predictions for the authenticated teamspace in reverse chronological order. Use `after` with `next_cursor` from the previous response to paginate.



## OpenAPI

````yaml get /batch-predictions
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /batch-predictions:
    get:
      tags:
        - Batch Predictions
      summary: List batch predictions
      description: >-
        Returns batch predictions for the authenticated teamspace in reverse
        chronological order. Use `after` with `next_cursor` from the previous
        response to paginate.
      operationId: BatchPredictions.listBatchPredictions
      parameters:
        - name: limit
          in: query
          required: false
          description: >-
            The maximum number of batch predictions to return, between 1 and
            100.
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
        - name: after
          in: query
          required: false
          description: Opaque cursor returned by a previous list call.
          schema:
            type: string
            x-stainless-pagination-property:
              purpose: next_cursor_param
        - name: status
          in: query
          required: false
          description: Optional filter by batch prediction status.
          schema:
            $ref: '#/components/schemas/BatchPredictionStatus'
      responses:
        '200':
          description: List of batch predictions
          headers:
            X-Request-Id:
              description: Request identifier for tracing and support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchPredictionList'
        '401':
          description: Unauthorized. Authentication is required to list batch predictions.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '422':
          description: Validation failed. The query parameters are invalid.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationProblemDetails'
        '429':
          description: Rate limit exceeded. The request has been throttled.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Datagrid from 'datagrid-ai';


            const client = new Datagrid({
              apiKey: process.env['DATAGRID_API_KEY'], // This is the default and can be omitted
            });


            // Automatically fetches more pages as needed.

            for await (const batchPrediction of client.batchPredictions.list())
            {
              console.log(batchPrediction.id);
            }
        - lang: Python
          source: |-
            import os
            from datagrid_ai import Datagrid

            client = Datagrid(
                api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
            )
            page = client.batch_predictions.list()
            page = page.data[0]
            print(page.id)
components:
  schemas:
    BatchPredictionStatus:
      type: string
      description: >-
        Current batch lifecycle state. Terminal states are `completed`,
        `failed`, `expired`, and `cancelled`.
      enum:
        - validating
        - failed
        - in_progress
        - finalizing
        - completed
        - expired
        - cancelling
        - cancelled
    BatchPredictionList:
      type: object
      description: Cursor-paginated list of batch predictions.
      required:
        - object
        - data
        - next_cursor
        - has_more
      properties:
        object:
          type: string
          enum:
            - list
          description: The object type, which is always `list`.
        data:
          type: array
          items:
            $ref: '#/components/schemas/BatchPrediction'
          description: Batch predictions in reverse chronological order.
          x-stainless-pagination-property:
            purpose: items
        next_cursor:
          type: string
          nullable: true
          description: Opaque cursor to fetch the next page.
          x-stainless-pagination-property:
            purpose: next_cursor_field
        has_more:
          type: boolean
          description: Whether another page is available.
    ProblemDetails:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
          format: uri-reference
    ValidationProblemDetails:
      allOf:
        - $ref: '#/components/schemas/ProblemDetails'
        - type: object
          required:
            - errors
          properties:
            errors:
              type: array
              description: >-
                Field-level validation issues. Item-level issues may include
                `custom_id` when Datagrid can associate the issue with a
                submitted item.
              items:
                $ref: '#/components/schemas/ValidationProblemError'
    BatchPrediction:
      type: object
      description: >-
        The `batch_prediction` object represents an asynchronous batch
        prediction job.
      required:
        - object
        - id
        - status
        - model
        - completion_window
        - created_at
        - expires_at
        - in_progress_at
        - finalizing_at
        - completed_at
        - failed_at
        - cancelling_at
        - cancelled_at
        - expired_at
        - request_counts
        - metadata
        - error
        - results_url
      properties:
        object:
          type: string
          enum:
            - batch_prediction
          description: The object type, which is always `batch_prediction`.
        id:
          type: string
          description: The id of the batch prediction.
        status:
          $ref: '#/components/schemas/BatchPredictionStatus'
        model:
          $ref: '#/components/schemas/BatchPredictionModel'
        completion_window:
          type: string
          enum:
            - 24h
          description: Requested completion window.
        created_at:
          type: string
          format: date-time
          description: ISO timestamp when the batch was created.
        expires_at:
          type: string
          format: date-time
          description: ISO timestamp when the batch completion window expires.
        in_progress_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO timestamp when the batch entered `in_progress`, or `null` if it
            has not.
        finalizing_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO timestamp when the batch entered `finalizing`, or `null` if it
            has not.
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO timestamp when the batch reached `completed`, or `null`
            otherwise.
        failed_at:
          type: string
          format: date-time
          nullable: true
          description: ISO timestamp when the batch reached `failed`, or `null` otherwise.
        cancelling_at:
          type: string
          format: date-time
          nullable: true
          description: ISO timestamp when cancellation was requested, or `null` otherwise.
        cancelled_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO timestamp when the batch reached `cancelled`, or `null`
            otherwise.
        expired_at:
          type: string
          format: date-time
          nullable: true
          description: ISO timestamp when the batch reached `expired`, or `null` otherwise.
        request_counts:
          $ref: '#/components/schemas/BatchPredictionRequestCounts'
        metadata:
          $ref: '#/components/schemas/Metadata'
        error:
          allOf:
            - $ref: '#/components/schemas/ProblemDetails'
          nullable: true
          description: >-
            Batch-level terminal error details for `failed`, `cancelled`, or
            `expired` batches; otherwise `null`.
        results_url:
          type: string
          format: uri-reference
          nullable: true
          description: >-
            Relative URL for the NDJSON results stream once the batch is
            terminal. This becomes `null` after retained result lines are
            cleaned up.
      example:
        object: batch_prediction
        id: bpred_abc123
        status: completed
        model: gemini-2.5-flash
        completion_window: 24h
        created_at: '2026-04-10T12:00:00.000Z'
        expires_at: '2026-04-11T12:00:00.000Z'
        in_progress_at: '2026-04-10T12:01:00.000Z'
        finalizing_at: '2026-04-10T12:05:00.000Z'
        completed_at: '2026-04-10T12:06:00.000Z'
        failed_at: null
        cancelling_at: null
        cancelled_at: null
        expired_at: null
        request_counts:
          total: 2
          processing: 0
          succeeded: 2
          errored: 0
          canceled: 0
          expired: 0
        metadata:
          project: alpha
        error: null
        results_url: /v1/batch-predictions/bpred_abc123/results
    ValidationProblemError:
      type: object
      required:
        - pointer
        - code
        - message
      properties:
        pointer:
          type: string
          description: JSON Pointer to the invalid request field.
        code:
          type: string
          description: Machine-readable validation code.
        message:
          type: string
          description: Human-readable validation message.
        custom_id:
          type: string
          nullable: true
          description: >-
            Submitted item `custom_id` associated with this issue, when
            available.
    BatchPredictionModel:
      type: string
      description: >-
        LLM model to use for every item in the batch. Model availability is
        cloud-aware: AWS teamspaces accept Bedrock-native batch-capable models,
        while GCP teamspaces accept non-Bedrock batch-capable models and reject
        Bedrock-only ids. Deprecated gemini-2.0-flash is accepted for backward
        compatibility and automatically runs as gemini-3.1-flash-lite.
      enum:
        - gemini-2.0-flash
        - gemini-2.5-flash
        - gemini-2.5-flash-lite
        - gemini-3.1-flash-lite
        - gemini-3.5-flash
        - gemini-2.5-pro
        - gemini-3.1-pro-preview
        - gpt-4o
        - gpt-4o-mini
        - gpt-4.1-mini
        - gpt-4.1
        - gpt-5-mini
        - gpt-5
        - gpt-5.1
        - claude-sonnet-4@20250514
        - claude-opus-4-1@20250805
        - claude-haiku-4-5@20251001
        - claude-sonnet-4-5@20250929
        - claude-sonnet-4-6@default
        - claude-opus-4-5@20251101
        - claude-opus-4-6@default
        - claude-opus-4-7
        - claude-opus-4-8
        - anthropic.claude-haiku-4-5-20251001-v1:0
        - anthropic.claude-sonnet-4-5-20250929-v1:0
        - anthropic.claude-sonnet-4-6
        - anthropic.claude-opus-4-5-20251101-v1:0
        - anthropic.claude-opus-4-6-v1
        - anthropic.claude-opus-4-7
        - anthropic.claude-opus-4-8
        - amazon.nova-2-lite-v1:0
    BatchPredictionRequestCounts:
      type: object
      required:
        - total
        - processing
        - succeeded
        - errored
        - canceled
        - expired
      properties:
        total:
          type: integer
          minimum: 0
          description: Total number of submitted items.
        processing:
          type: integer
          minimum: 0
          description: Items that are still pending or processing.
        succeeded:
          type: integer
          minimum: 0
          description: Items that completed with a valid output.
        errored:
          type: integer
          minimum: 0
          description: Items that ended with an error.
        canceled:
          type: integer
          minimum: 0
          description: Items that were cancelled before completion.
        expired:
          type: integer
          minimum: 0
          description: Items that did not finish before the completion window elapsed.
      description: >-
        The sum of processing, succeeded, errored, canceled, and expired equals
        total.
    Metadata:
      type: object
      description: >-
        Optional metadata map with up to 16 entries. Metadata keys must be 64
        characters or fewer and values must be 512 characters or fewer.
      maxProperties: 16
      additionalProperties:
        type: string
        maxLength: 512
      nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````