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

# Criar custo

> Cria um custo adicional manual (ex.: aluguel, plataformas, marketing). Custos do tipo `marketing` ou `product` disparam automaticamente o recálculo das métricas. Requer o escopo `costs.write`.



## OpenAPI

````yaml post /costs
openapi: 3.1.0
info:
  title: Solomon Admin API
  description: API aberta para integração com a Solomon
  license:
    name: MIT
  version: 1.1.0
servers:
  - url: https://admin-api.sandbox.solomon.com.br/admin/v1
  - url: https://admin-api.solomon.com.br/admin/v1
security:
  - ApiKeyAuth: []
paths:
  /costs:
    post:
      summary: Criar custo adicional
      description: >-
        Cria um custo adicional manual (ex.: aluguel, plataformas, marketing).
        Custos do tipo `marketing` ou `product` disparam automaticamente o
        recálculo das métricas. Requer o escopo `costs.write`.
      operationId: createCost
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdditionalCost'
            example:
              name: Aluguel do galpão
              date: '2026-08-01'
              end_date: '2026-12-31'
              status: active
              type: aluguel
              value: 3500
              frequency: monthly
      responses:
        '200':
          description: Custo criado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostMutationResponse'
        '400':
          description: Erro de validação
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Erro interno do servidor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AdditionalCost:
      type: object
      required:
        - name
        - date
        - status
        - type
        - value
        - frequency
      properties:
        additional_cost_id:
          type: string
          maxLength: 10
          description: >-
            ID do custo (até 10 caracteres). Opcional no POST (gerado quando
            ausente); obrigatório no PUT.
        name:
          type: string
          description: Nome/descrição do custo
        date:
          type: string
          format: date
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: Data inicial
          example: '2026-08-01'
        end_date:
          type: string
          format: date
          description: Data final (opcional; vazio projeta até hoje)
        status:
          type: string
          enum:
            - active
            - inactive
        type:
          type: string
          description: >-
            Tipo do custo (ex.: `marketing`, `product`, `aluguel`,
            `plataformas`, `outros`). `marketing` e `product` recalculam
            métricas.
          example: marketing
        value:
          type: number
          description: Valor do custo
          example: 3500
        frequency:
          type: string
          enum:
            - specific
            - daily
            - weekly
            - monthly
          description: Frequência do custo. `specific` = pontual.
        utm_source:
          type: string
          description: Canal (opcional)
        old_frequency:
          type: string
          enum:
            - specific
            - daily
            - weekly
            - monthly
          description: 'Apenas no PUT: frequência anterior, quando ela mudou.'
    CostMutationResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
          properties:
            created:
              $ref: '#/components/schemas/CostEntry'
            data:
              type: object
              description: Bucket resultante da frequência
              additionalProperties:
                $ref: '#/components/schemas/CostEntry'
        request_id:
          type: string
        timestamp:
          type: string
    Error:
      type: object
      properties:
        success:
          type: boolean
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
        request_id:
          type: string
        timestamp:
          type: string
    CostEntry:
      type: object
      description: Um custo adicional como armazenado.
      properties:
        name:
          type: string
        date:
          type: string
          description: Data inicial (ISO `YYYY-MM-DD`)
        end_date:
          type: string
          description: Data final (ISO `YYYY-MM-DD`) ou vazio
        status:
          type: string
          enum:
            - active
            - inactive
        type:
          type: string
          example: marketing
        value:
          type: number
          example: 3500
        utm_source:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: API Key para autenticação

````