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

# Criar lote



## OpenAPI

````yaml /openapi.json post /events/{event}/batches
openapi: 3.1.0
info:
  title: Eventor Management API v1
  version: 1.0.0
  description: >-
    Management API do Eventor (Fase 9) — configuração de evento ponta a ponta
    por agente/CLI. Autenticação: `Authorization: Bearer <api_key>` com escopo
    `manage`.


    Envelope de sucesso: `{data}` (item) e `{data,meta,links}` (coleção
    paginada).

    Envelope de erro: `{error,message,details}`.
servers:
  - url: http://localhost/api/v1
security:
  - bearerAuth: []
paths:
  /events/{event}/batches:
    post:
      tags:
        - Batches
      summary: Criar lote
      operationId: batches.store
      parameters:
        - name: event
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreBatchRequest'
      responses:
        '201':
          description: '`JsonResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RegistrationBatchResource'
                required:
                  - data
        '401':
          description: API key ausente ou inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: A API key não tem o escopo `manage`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Recurso não encontrado neste hub.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: 'Conflito (ex.: dependência que impede a operação).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Falha de validação dos dados enviados.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    StoreBatchRequest:
      type: object
      description: >-
        POST /api/v1/events/{event}/batches — cria ingresso/lote.

        Espelha EventSales::saveBatch (batchForm). A validação de que as chaves
        de

        race_prices pertencem ao evento é feita no controller (precisa do evento
        resolvido).
      properties:
        name:
          type: string
          maxLength: 120
        starts_at:
          type:
            - string
            - 'null'
          format: date-time
        ends_at:
          type:
            - string
            - 'null'
          format: date-time
        max_quantity:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 1000000
        includes_kit:
          type: boolean
        is_active:
          type: boolean
        installments_enabled:
          type: boolean
        max_installments:
          type: integer
          minimum: 1
          maximum: 12
        absorb_installment_interest:
          type: boolean
        race_prices:
          type: array
          description: >-
            { race_id: price_cents } — única fonte de preço E cobertura. Ao
            menos 1.
          items:
            type: integer
            minimum: 0
          minItems: 1
      required:
        - name
        - max_installments
        - race_prices
      title: StoreBatchRequest
    RegistrationBatchResource:
      type: object
      properties:
        id:
          type: integer
        event_id:
          type: integer
        name:
          type: string
        starts_at:
          type: string
        ends_at:
          type: string
        includes_kit:
          type: boolean
        max_quantity:
          type:
            - integer
            - 'null'
        quantity_sold:
          type: integer
        quantity_reserved:
          type: integer
        is_active:
          type: boolean
        installments_enabled:
          type: boolean
        max_installments:
          type: integer
        absorb_installment_interest:
          type: boolean
        sort_order:
          type: integer
        race_prices:
          type: array
          description: >-
            { race_id: price_cents } — única fonte de preço E cobertura do
            ingresso.
          items: {}
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - event_id
        - name
        - starts_at
        - ends_at
        - includes_kit
        - max_quantity
        - quantity_sold
        - quantity_reserved
        - is_active
        - installments_enabled
        - max_installments
        - absorb_installment_interest
        - sort_order
        - race_prices
        - created_at
        - updated_at
      title: RegistrationBatchResource
    ApiError:
      type: object
      properties:
        error:
          type: string
          description: >-
            Código machine-parseable (ex.: validation_failed, forbidden_scope,
            not_found).
        message:
          type: string
          description: Mensagem legível (português).
        details:
          type:
            - object
            - 'null'
          description: 'Detalhes opcionais (ex.: erros de validação por campo).'
          additionalProperties: {}
      required:
        - error
        - message
      title: ApiError
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        API key do hub com escopo `manage`. Header: `Authorization: Bearer
        <api_key>`.
      scheme: bearer

````