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

# Importar resultados

> Idempotente pela chave natural do cronometrista (bib → atleta); ver
ResultImporter. Evento e prova vêm na URL (id|code).



## OpenAPI

````yaml /openapi.json post /events/{event}/races/{race}/results
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}/races/{race}/results:
    post:
      tags:
        - Results
      summary: Importar resultados
      description: |-
        Idempotente pela chave natural do cronometrista (bib → atleta); ver
        ResultImporter. Evento e prova vêm na URL (id|code).
      operationId: results.store
      parameters:
        - name: event
          in: path
          required: true
          schema:
            type: string
        - name: race
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreResultsRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: string
        '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:
    StoreResultsRequest:
      type: object
      description: >-
        Ingest de resultados via Management API — POST
        /api/v1/events/{event}/races/{race}/results.


        Evento e prova vêm na URL (resolvidos por id|code no controller); o
        corpo é só

        a modalidade do lote + o array de resultados.
      properties:
        modality_id:
          type:
            - integer
            - 'null'
          description: |-
            Modalidade do LOTE (id OU nome; id ganha). Vale pra todos os
            resultados, salvo override no item. Resolvida contra modalidades
            existentes — nunca cria.
        modality:
          type:
            - string
            - 'null'
          maxLength: 80
        results:
          type: array
          items:
            type: object
            properties:
              external_id:
                type:
                  - string
                  - 'null'
                description: Referência livre do cronometrista — NÃO é chave de match.
                maxLength: 100
              athlete:
                type: object
                properties:
                  name:
                    type:
                      - string
                      - 'null'
                    maxLength: 120
                  document:
                    type:
                      - string
                      - 'null'
                    maxLength: 20
                  email:
                    type:
                      - string
                      - 'null'
                    format: email
                    maxLength: 150
                  birth_date:
                    type:
                      - string
                      - 'null'
                    format: date
                  sex:
                    type:
                      - string
                      - 'null'
                    enum:
                      - M
                      - F
                      - O
              category:
                type:
                  - string
                  - 'null'
                description: >-
                  Categoria por nome OU id (id ganha). category é obrigatório só
                  quando

                  category_id não vem. Nome é resolvido DENTRO da modalidade
                  efetiva

                  (categoria é modality-specific) e auto-criado se não existir.
                maxLength: 80
              category_id:
                type:
                  - integer
                  - 'null'
              modality_id:
                type:
                  - integer
                  - 'null'
                description: >-
                  Modalidade no nível do ATLETA (override do lote). id OU nome;
                  id ganha.
              modality:
                type:
                  - string
                  - 'null'
                maxLength: 80
              bib:
                type:
                  - string
                  - 'null'
                maxLength: 10
              net_time:
                type:
                  - string
                  - 'null'
                maxLength: 20
              gun_time:
                type:
                  - string
                  - 'null'
                maxLength: 20
              overall_position:
                type:
                  - integer
                  - 'null'
                minimum: 0
              category_position:
                type:
                  - integer
                  - 'null'
                minimum: 0
              gender_position:
                type:
                  - integer
                  - 'null'
                minimum: 0
              status:
                $ref: '#/components/schemas/ResultStatus'
              observation:
                type:
                  - string
                  - 'null'
                maxLength: 255
            required:
              - athlete
          minItems: 1
          maxItems: 5000
      required:
        - results
      title: StoreResultsRequest
    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
    ResultStatus:
      type: string
      enum:
        - finished
        - dnf
        - dns
        - dq
      title: ResultStatus
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        API key do hub com escopo `manage`. Header: `Authorization: Bearer
        <api_key>`.
      scheme: bearer

````