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

# Predict typed decisions over a state



## OpenAPI

````yaml /api-reference/openapi.json post /v2/decisions/predict
openapi: 3.1.0
info:
  title: Base39 API
  description: Base39 API
  version: 1.0.0
  contact:
    name: Base39 Team
    url: https://base39.com.br
    email: suporte@base39.com.br
  termsOfService: https://base39.com.br/termos
  license:
    name: Proprietary
    url: https://base39.com.br/termos
servers:
  - url: http://localhost:3000
    description: Local
  - url: https://api.dev.base39.cloud
    description: Development
  - url: https://api.base39.com.br
    description: Production
security:
  - OAuth2: []
tags:
  - name: pages
    description: Profiles and reports pages
  - name: pipelines
    description: Pipeline boards (kanban) of pages
  - name: blocks
    description: Blocks operations
  - name: search
    description: Search across content
  - name: targets
    description: Lookup targets via datasets
  - name: CognitoTriggers
    description: Cognito triggers
paths:
  /v2/decisions/predict:
    post:
      tags:
        - decisions
      summary: Predict typed decisions over a state
      operationId: decision_predict
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PredictDecisionInput'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecisionPredictionOutput'
components:
  schemas:
    PredictDecisionInput:
      type: object
      properties:
        state:
          type: object
          additionalProperties: true
          description: Text fields the model reads.
        questions:
          type: array
          items:
            $ref: '#/components/schemas/DecisionQuestionInput'
      required:
        - state
        - questions
    DecisionPredictionOutput:
      type: object
      properties:
        model:
          type: string
        answers:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/DecisionAnswerOutput'
          description: Answer per question name.
        usage:
          $ref: '#/components/schemas/DecisionUsageOutput'
      required:
        - model
        - answers
        - usage
    DecisionQuestionInput:
      type: object
      properties:
        name:
          type: string
          description: Key of the answer in the response.
        type:
          type: string
          enum:
            - choice
            - score
            - noul
        instructions:
          type: string
          description: What the model must decide. Reference state fields as `field`.
        criteria:
          description: Options, or ordered levels for score.
          type: array
          items:
            $ref: '#/components/schemas/DecisionCriterionInput'
      required:
        - name
        - type
        - instructions
        - criteria
    DecisionAnswerOutput:
      type: object
      properties:
        type:
          type: string
          enum:
            - choice
            - score
            - noul
        confidence:
          type: number
          description: Model confidence. The checkpoint ships uncalibrated.
        actProbability:
          type: number
          description: Probability that acting on this answer is appropriate.
        choice:
          type: string
          description: Selected option (choice).
        score:
          type: number
          description: Expected level index (score).
        noul:
          type: number
          description: Probability of true (noul).
        probabilities:
          type: object
          additionalProperties:
            type: number
          description: Probability per option (choice) or per level index (score).
        legend:
          type: object
          additionalProperties:
            type: string
          description: Level label per index (score).
      required:
        - type
        - confidence
        - actProbability
    DecisionUsageOutput:
      type: object
      properties:
        inputTokens:
          type: number
        outputTokens:
          type: number
      required:
        - inputTokens
        - outputTokens
    DecisionCriterionInput:
      type: object
      properties:
        label:
          type: string
          description: Option label. For noul questions it must be `false` or `true`.
        description:
          type: string
          description: When the option applies. Ignored for score levels.
      required:
        - label
        - description
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://id.local.base39.cloud/oauth2/authorize
          tokenUrl: https://id.local.base39.cloud/oauth2/token
          scopes:
            profile: Read user profile
            email: Read user email
            openid: OpenID authentication
      description: OAuth2 Authorization Code flow

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.