> ## 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.

# Aggiorna Batch

> Aggiorna i metadati per un batch specifico. Solo i metadati possono essere aggiornati dopo la creazione del batch.

<Tip>
  **Semantica di unione:** Gli aggiornamenti dei metadati seguono l'approccio di Stripe — le nuove chiavi vengono aggiunte, le chiavi esistenti vengono aggiornate e le chiavi impostate su stringa vuota `""` vengono eliminate.
</Tip>


## OpenAPI

````yaml it/openapi/batches.json PATCH /v1/batches/{batch_id}
openapi: 3.0.3
info:
  title: API dei Batch
  version: 1.0.0
servers:
  - url: https://api.olostep.com
security: []
paths:
  /v1/batches/{batch_id}:
    patch:
      summary: Aggiorna i metadati del batch
      description: >-
        Aggiorna i metadati per un batch specifico. Solo il campo `metadata` può
        essere aggiornato. Segue la semantica di fusione di Stripe: le nuove
        chiavi vengono aggiunte, le chiavi esistenti vengono aggiornate e le
        chiavi impostate su stringa vuota vengono eliminate.
      parameters:
        - name: batch_id
          in: path
          required: true
          schema:
            type: string
          description: L'ID del batch da aggiornare.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                metadata:
                  $ref: '#/components/schemas/Metadata'
              required:
                - metadata
            example:
              metadata:
                status: reviewed
                reviewer: jane@example.com
      responses:
        '200':
          description: Metadati del batch aggiornati con successo.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID del Batch
                  object:
                    type: string
                    description: Il tipo di oggetto. "batch" per questo endpoint.
                  status:
                    type: string
                    description: '`in_progress` o `completed`'
                  created:
                    type: number
                    description: Epoch creato
                  total_urls:
                    type: number
                    description: Conteggio degli URL nel batch
                  completed_urls:
                    type: number
                    description: Conteggio degli URL completati
                  metadata:
                    $ref: '#/components/schemas/Metadata'
              example:
                id: batch_abc123def456
                object: batch
                status: completed
                created: 1704067200
                total_urls: 10
                completed_urls: 10
                metadata:
                  batch_name: Q1 Product Sync
                  status: reviewed
                  reviewer: jane@example.com
        '400':
          description: >-
            Richiesta errata - metadati mancanti o non validi. Vedi [Richiesta
            Errata](/api-reference/errors/bad_request) per i dettagli.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                id: error_abc123
                object: error
                code: invalid_metadata
                type: https://docs.olostep.com/api-reference/errors/bad_request
                status: 400
                title: Richiesta Errata
                detail: No metadata field provided. Only metadata can be updated.
                created: 1704067200
                metadata: {}
        '401':
          description: >-
            Le credenziali di autenticazione sono mancanti o non valide. Vedi
            [Unauthorized](/api-reference/errors/unauthorized) per i dettagli.
          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: Non autorizzato
                detail: Your API key is invalid
                created: 1704067200
                metadata: {}
        '404':
          description: >-
            Batch non trovato per l'ID fornito. Vedi [Non
            Trovato](/api-reference/errors/not_found) per i dettagli.
          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: Non Trovato
                detail: Batch not found
                created: 1704067200
                metadata: {}
        '500':
          description: >-
            Errore interno del server. Vedi [Internal
            Error](/api-reference/errors/internal_error) per i dettagli.
          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: Errore Interno del Server
                detail: An unexpected error occurred
                created: 1704067200
                metadata: {}
      security:
        - Authorization: []
components:
  schemas:
    Metadata:
      type: object
      description: >-
        Insieme di coppie chiave-valore per memorizzare informazioni aggiuntive
        su un oggetto. Segue l'approccio di Stripe con regole di validazione:
        massimo 50 chiavi, chiave massimo 40 caratteri (senza parentesi quadre),
        valore massimo 500 caratteri, tutti i valori memorizzati come stringhe.
      additionalProperties:
        type: string
        maxLength: 500
        description: >-
          Valore dei metadati (max 500 caratteri). Numeri e booleani sono
          automaticamente convertiti in stringhe.
      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: Risposta di errore Dettagli Problema RFC 7807
      properties:
        id:
          type: string
          description: Identificatore univoco dell'errore
        object:
          type: string
          enum:
            - error
          description: Sempre 'error'
        code:
          type: string
          description: Codice di errore leggibile dalla macchina
        type:
          type: string
          format: uri
          description: Riferimento URI che identifica il tipo di problema
        status:
          type: integer
          description: Codice di stato HTTP
        title:
          type: string
          description: Breve riassunto leggibile dall'uomo
        detail:
          type: string
          description: Spiegazione leggibile dall'uomo
        created:
          type: integer
          description: Timestamp Unix
        metadata:
          $ref: '#/components/schemas/Metadata'
        errors:
          type: array
          description: Array opzionale di dettagli aggiuntivi sull'errore
          items: {}
      required:
        - id
        - object
        - code
        - type
        - status
        - title
        - detail
        - created
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: >-
        Intestazione di autenticazione Bearer del tipo Bearer <token>, dove
        <token> è il tuo token di autenticazione.

````