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



## OpenAPI

````yaml /openapi.json post /events/{event}/races/{race}/categories
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}/categories:
    post:
      tags:
        - Categories
      summary: Criar categoria
      operationId: categories.store
      parameters:
        - name: event
          in: path
          required: true
          schema:
            type: string
        - name: race
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreCategoryRequest'
      responses:
        '201':
          description: '`JsonResource`'
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/JsonResource'
                    required:
                      - data
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          category_group_id:
                            type: string
                          categories:
                            type: array
                            items:
                              $ref: '#/components/schemas/CategoryResource'
                        required:
                          - category_group_id
                          - categories
                    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:
    StoreCategoryRequest:
      type: object
      description: |-
        POST /api/v1/events/{event}/races/{race}/categories — cria categoria.
        Espelha RaceView::saveCategory (categoryForm).
      properties:
        name:
          type: string
          maxLength: 80
        type:
          type:
            - string
            - 'null'
          maxLength: 20
        modality_id:
          type:
            - integer
            - 'null'
          description: >-
            Atalho retrocompat (1 linha). Pra fan-out por modalidade, use
            modality_ids.
        sex:
          type:
            - string
            - 'null'
          enum:
            - M
            - F
        age_min:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 120
        age_max:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 120
        award_count:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 100
        is_pwd:
          type:
            - boolean
            - 'null'
        is_team:
          type:
            - boolean
            - 'null'
        sort_order:
          type:
            - integer
            - 'null'
        status:
          $ref: '#/components/schemas/CommonStatus'
        modality_ids:
          type:
            - array
            - 'null'
          description: >-
            Materializa 1 categoria por modalidade marcada (subconjunto das da
            prova).
          items:
            type: integer
      required:
        - name
      title: StoreCategoryRequest
    JsonResource:
      type: string
      title: JsonResource
    CategoryResource:
      type: object
      properties:
        id:
          type: integer
        race_id:
          type: integer
        event_id:
          type:
            - integer
            - 'null'
        name:
          type: string
        type:
          type: string
        modality_id:
          type:
            - integer
            - 'null'
        category_group_id:
          type:
            - string
            - 'null'
        sex:
          type:
            - string
            - 'null'
        age_min:
          type:
            - integer
            - 'null'
        age_max:
          type:
            - integer
            - 'null'
        award_count:
          type: integer
        is_pwd:
          type: boolean
        is_team:
          type: boolean
        sort_order:
          type:
            - integer
            - 'null'
        status:
          type: string
        modality:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - race_id
        - event_id
        - name
        - type
        - modality_id
        - category_group_id
        - sex
        - age_min
        - age_max
        - award_count
        - is_pwd
        - is_team
        - sort_order
        - status
        - created_at
        - updated_at
      title: CategoryResource
    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
    CommonStatus:
      type: string
      description: >
        Status genérico usado por várias entidades (Hub, User, Group, Category,
        etc.). Entidades com estados específicos (Event, Registration) têm enums
        próprios.
      enum:
        - active
        - inactive
        - suspended
      title: CommonStatus
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        API key do hub com escopo `manage`. Header: `Authorization: Bearer
        <api_key>`.
      scheme: bearer

````