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

# Criar fonte

> Uma fonte nova, com canal, finalidade, audiência e teto de verificação.



## OpenAPI

````yaml openapi/pt/control.json POST /v1/sources
openapi: 3.1.0
info:
  title: API de controle da Niadra
  version: '1'
  description: >-
    Tenants, projetos, fontes, chaves, pessoas, configuração e uso. Nunca recebe
    conteúdo de cliente.
servers:
  - url: https://control.api.niadra.com
security: []
paths:
  /v1/sources:
    post:
      summary: Criar fonte
      description: >-
        Cria uma fonte num espaço. O acesso à memória é negado por padrão e
        liberado por finalidade na política; o teto de verificação limita o
        nível que a fonte pode declarar. Exige o papel admin.


        **Autenticação.** Token de pessoa emitido pelo controle (`Authorization:
        Bearer <JWT>`), com o papel que a operação pede.
      operationId: create_source_v1_sources_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceCreate'
            example:
              space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
              name: Billing agent
              audience: internal_agent
              vendor: in-house
              channel: erp
              purposes:
                - billing
              verification_ceiling: no_customer
              trusted_action_ops:
                - credit
              navigation_enabled: true
              confirms_before_acting: false
              critical: false
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceOut'
              example:
                source_id: 0192f0a0-5f60-7172-8d83-9e0f1a2b3c45
                space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
                name: Billing agent
                audience: internal_agent
                vendor: in-house
                channel: erp
                purposes:
                  - billing
                verification_ceiling: no_customer
                confirms_before_acting: false
                navigation_enabled: true
                trusted_action_ops:
                  - credit
                critical: false
                revoked_at: null
          description: A fonte.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - personToken: []
components:
  schemas:
    SourceCreate:
      additionalProperties: false
      properties:
        audience:
          $ref: '#/components/schemas/Audience'
          description: >-
            O que a fonte pode ler, pela classe de audiência: agente que fala
            com o cliente, agente interno, mesa humana e outras.
        channel:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Channel
        confirms_before_acting:
          default: false
          title: Confirms Before Acting
          type: boolean
          description: >-
            O agente confirma valores antes de agir, então a medição não conta
            essas confirmações como pergunta repetida.
        critical:
          default: false
          title: Critical
          type: boolean
          description: >-
            As sessões desta fonte ficam fora dos grupos de controle e sempre
            recebem a memória.
        name:
          maxLength: 256
          minLength: 1
          title: Name
          type: string
        navigation_enabled:
          default: true
          title: Navigation Enabled
          type: boolean
          description: Se a fonte pode usar as ferramentas de navegação do histórico.
        purposes:
          items:
            maxLength: 256
            minLength: 1
            type: string
          maxItems: 32
          title: Purposes
          type: array
          description: >-
            As finalidades pelas quais a política libera o acesso, como
            `customer_service` ou `billing`.
        space_id:
          format: uuid
          title: Space Id
          type: string
        trusted_action_ops:
          items:
            maxLength: 256
            minLength: 1
            type: string
          maxItems: 64
          title: Trusted Action Ops
          type: array
          description: >-
            Operações em que as ações declaradas por esta fonte podem fechar
            pendências antes de o sistema de registro confirmar.
        vendor:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Vendor
        verification_ceiling:
          $ref: '#/components/schemas/Verification'
          default: V2
          description: >-
            O nível de verificação mais alto que esta fonte pode declarar: V2
            para agentes automatizados, V3 para fontes que fazem OTP, V4 só para
            mesa humana e sistema de registro, `no_customer` para agentes
            internos.
      required:
        - space_id
        - name
        - audience
      title: SourceCreate
      type: object
    SourceOut:
      additionalProperties: false
      properties:
        audience:
          $ref: '#/components/schemas/Audience'
        channel:
          anyOf:
            - type: string
            - type: 'null'
          title: Channel
        confirms_before_acting:
          title: Confirms Before Acting
          type: boolean
        critical:
          title: Critical
          type: boolean
        name:
          title: Name
          type: string
        navigation_enabled:
          title: Navigation Enabled
          type: boolean
        purposes:
          items:
            type: string
          title: Purposes
          type: array
        revoked_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Revoked At
        source_id:
          format: uuid
          title: Source Id
          type: string
        space_id:
          format: uuid
          title: Space Id
          type: string
        trusted_action_ops:
          items:
            type: string
          title: Trusted Action Ops
          type: array
        vendor:
          anyOf:
            - type: string
            - type: 'null'
          title: Vendor
        verification_ceiling:
          $ref: '#/components/schemas/Verification'
      required:
        - source_id
        - space_id
        - name
        - audience
        - vendor
        - channel
        - purposes
        - verification_ceiling
        - confirms_before_acting
        - navigation_enabled
        - trusted_action_ops
        - critical
        - revoked_at
      title: SourceOut
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    Audience:
      enum:
        - customer_agent
        - internal_agent
        - human
        - reviewer
        - analyst
        - trigger_target
        - export
      title: Audience
      type: string
    Verification:
      description: >-
        Níveis de verificação da sessão. `no_customer` fica fora da escala de V0
        a V4.
      enum:
        - V0
        - V1
        - V2
        - V3
        - V4
        - no_customer
      title: Verification
      type: string
  securitySchemes:
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````