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

# 批处理项目

> 检索批处理中处理的项目列表。然后你可以使用 `retrieve_id` 通过检索端点获取内容

<Tip>
  **元数据：** 如果你在[创建批处理](/api-reference/batches/create)时为各个项目附加了 `metadata`，它将在响应中随每个项目一起返回。
</Tip>


## OpenAPI

````yaml zh/openapi/batches.json GET /v1/batches/{batch_id}/items
openapi: 3.0.3
info:
  title: 批处理 API
  version: 1.0.0
servers:
  - url: https://api.olostep.com
security: []
paths:
  /v1/batches/{batch_id}/items:
    get:
      summary: 可选地获取特定批次的已完成或失败项目列表及其内容
      description: 根据请求的状态获取特定批次ID的项目和内容列表。
      parameters:
        - name: batch_id
          in: path
          required: true
          schema:
            type: string
          description: 要获取项目的批次ID。
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - completed
              - failed
          description: 要获取的URL状态（已完成或失败）。
        - name: cursor
          in: query
          required: false
          schema:
            type: integer
          description: >-
            分页游标。首次请求时省略此参数。对于后续请求，使用上一个响应中的 `cursor` 值。详情请参见
            [分页](/api-reference/common/pagination)。
        - name: limit
          in: query
          required: false
          schema:
            type: integer
          description: 返回结果的数量（建议10-50）。
      responses:
        '200':
          description: 批量项目的成功响应。
          content:
            application/json:
              schema:
                type: object
                properties:
                  batch_id:
                    type: string
                  object:
                    type: string
                  status:
                    type: string
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        custom_id:
                          type: string
                        retrieve_id:
                          type: string
                        url:
                          type: string
                        metadata:
                          allOf:
                            - $ref: '#/components/schemas/Metadata'
                          description: 如果在批量创建时提供，则为项目级元数据。
                        links_on_page:
                          type: array
                          items:
                            type: string
                  items_count:
                    type: integer
                  cursor:
                    type: integer
                    description: >-
                      分页游标。当有更多结果可用时出现。在下一个请求的 `cursor`
                      参数中使用此值。详情请参见[分页](/api-reference/common/pagination)。
              example:
                batch_id: batch_abc123def456
                object: list
                status: completed
                items:
                  - custom_id: product-123
                    retrieve_id: ret_xyz789
                    url: https://example.com/product/123
                    metadata:
                      source: catalog_sync
                      priority: high
                  - custom_id: product-456
                    retrieve_id: ret_abc456
                    url: https://example.com/product/456
                items_count: 2
        '400':
          description: 由于参数错误导致的错误请求。详情请参见[错误请求](/api-reference/errors/bad_request)。
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                id: error_abc123
                object: error
                code: validation_error
                type: https://docs.olostep.com/api-reference/errors/bad_request
                status: 400
                title: 错误请求
                detail: Status must be either 'completed' or 'failed'
                created: 1704067200
                metadata: {}
        '401':
          description: >-
            身份验证凭据缺失或无效。详情请参阅
            [Unauthorized](/api-reference/errors/unauthorized)。
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                id: error_abc123
                object: error
                code: invalid_api_key
                type: https://docs.olostep.com/api-reference/errors/unauthorized
                status: 401
                title: 未授权
                detail: Your API key is invalid
                created: 1704067200
                metadata: {}
        '404':
          description: 提供的ID未找到批次。详情请参见 [未找到](/api-reference/errors/not_found)。
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                id: error_abc123
                object: error
                code: batch_not_found
                type: https://docs.olostep.com/api-reference/errors/not_found
                status: 404
                title: 未找到
                detail: Batch not found
                created: 1704067200
                metadata: {}
        '500':
          description: >-
            内部服务器错误。详情请参阅 [Internal
            Error](/api-reference/errors/internal_error)。
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                id: error_abc123
                object: error
                code: internal_server_error
                type: https://docs.olostep.com/api-reference/errors/internal_error
                status: 500
                title: 内部服务器错误
                detail: An unexpected error occurred
                created: 1704067200
                metadata: {}
      security:
        - Authorization: []
components:
  schemas:
    Metadata:
      type: object
      description: >-
        用于存储对象附加信息的键值对集合。遵循Stripe的验证规则：最多50个键，键最多40个字符（不含方括号），值最多500个字符，所有值以字符串形式存储。
      additionalProperties:
        type: string
        maxLength: 500
        description: 元数据值（最多500个字符）。数字和布尔值会自动转换为字符串。
      maxProperties: 50
      example:
        order_id: '12345'
        customer_name: John Doe
        priority: high
        processed: 'true'
      x-validation-rules:
        max_keys: 50
        key_max_length: 40
        key_forbidden_chars:
          - '['
          - ']'
        value_max_length: 500
        value_types:
          - string
          - number (coerced)
          - boolean (coerced)
    Error:
      type: object
      description: RFC 7807 问题详情错误响应
      properties:
        id:
          type: string
          description: 唯一错误标识符
        object:
          type: string
          enum:
            - error
          description: 始终为 'error'
        code:
          type: string
          description: 机器可读的错误代码
        type:
          type: string
          format: uri
          description: 标识问题类型的URI引用
        status:
          type: integer
          description: HTTP状态码
        title:
          type: string
          description: 简短的、可读的摘要
        detail:
          type: string
          description: 可读的解释
        created:
          type: integer
          description: Unix时间戳
        metadata:
          $ref: '#/components/schemas/Metadata'
        errors:
          type: array
          description: 可选的附加错误详情数组
          items: {}
      required:
        - id
        - object
        - code
        - type
        - status
        - title
        - detail
        - created
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: Bearer认证头格式为Bearer <token>，其中<token>是你的认证令牌。

````