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

# Make a structured decision

> Get a typed answer with a calibrated probability, instead of prose to parse.

Send your application `state` plus named `questions`. Each question declares its
own `type`: `choice` picks one of your options and reports a probability for each,
`score` rates against an ordered scale, and `noul` returns a single probability.

`noul` is a **probability in [0, 1]**, not a true/false — despite the name.

The answers come back keyed by your own question names. This endpoint is **beta**:
it rides an upstream path we do not control, so the contract may change.



## OpenAPI

````yaml /api/openapi.json post /v1/evaluate
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/evaluate:
    post:
      tags:
        - Evaluate
      summary: Make a structured decision
      description: >-
        Get a typed answer with a calibrated probability, instead of prose to
        parse.


        Send your application `state` plus named `questions`. Each question
        declares its

        own `type`: `choice` picks one of your options and reports a probability
        for each,

        `score` rates against an ordered scale, and `noul` returns a single
        probability.


        `noul` is a **probability in [0, 1]**, not a true/false — despite the
        name.


        The answers come back keyed by your own question names. This endpoint is
        **beta**:

        it rides an upstream path we do not control, so the contract may change.
      operationId: create_evaluation
      parameters:
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
              - 2026-09
            default: 2026-08
          example: 2026-09
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateRequest'
      responses:
        '200':
          description: Typed answers, one per question
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluateResponse'
              example:
                id: eval_2f9c4a1b8d3e5f7a6c0b9d2e
                model: typesafe/jev-1.13
                answers:
                  department:
                    type: choice
                    choice: billing
                    probabilities:
                      billing: 1
                      technical: 0
                    confidence: 1
                  urgency:
                    type: score
                    score: 1.3
                    legend:
                      '0': Can wait a week
                      '1': Within a day
                      '2': Immediately
                    probabilities:
                      '0': 0.01
                      '1': 0.68
                      '2': 0.31
                    confidence: 0.53
                  needs_human:
                    type: noul
                    noul: 0.8
                usage:
                  input_tokens: 396
                  output_tokens: 64
                  total_tokens: 460
        '400':
          description: The model does not exist, or cannot serve this request
        '401':
          description: Missing or invalid API key
        '402':
          description: Insufficient credits
        '403':
          description: API key is suspended, or lacks the evaluate:write scope
        '422':
          description: Request validation failed
        '429':
          description: Rate limit exceeded (RPM or RPD)
        '500':
          description: Mesh-internal error — do not retry
        '503':
          description: Upstream provider error, or credentials not configured
        '504':
          description: Upstream provider did not respond in time
      security:
        - BearerAuth: []
components:
  schemas:
    EvaluateRequest:
      properties:
        model:
          type: string
          title: Model
          description: Which model decides. Use an id from GET /v1/models.
        state:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - items: {}
              type: array
          title: State
          description: >-
            The application state to judge — free text, or any JSON object or
            array. Every question is answered against this same state.
        questions:
          patternProperties:
            ^[A-Za-z0-9_-]{1,64}$:
              oneOf:
                - $ref: '#/components/schemas/NoulQuestion'
                - $ref: '#/components/schemas/ChoiceQuestion'
                - $ref: '#/components/schemas/ScoreQuestion'
              discriminator:
                propertyName: type
                mapping:
                  choice: '#/components/schemas/ChoiceQuestion'
                  noul: '#/components/schemas/NoulQuestion'
                  score: '#/components/schemas/ScoreQuestion'
          type: object
          minProperties: 1
          title: Questions
          description: >-
            The questions to answer, keyed by your own name for each. Those
            names are the keys of the answers you get back.
        tags:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Tags
          description: >-
            Your own labels for this request, echoed back on the usage row and
            available as a filter and a group-by dimension in the usage API.
            String keys to string values. Never put personal or sensitive data
            here — tags are stored with the usage record and are not redacted.
          examples:
            - env: prod
              feature: summariser
        safety_identifier:
          anyOf:
            - type: string
              maxLength: 256
            - type: 'null'
          title: Safety Identifier
          description: >-
            A stable, anonymised identifier for the end user making this
            request, recorded on the usage row and available as a filter and a
            group-by dimension in the usage API. Supersedes the deprecated
            `user` field. Use an opaque id, not an email address or a name.
      additionalProperties: false
      type: object
      required:
        - model
        - state
        - questions
      title: EvaluateRequest
      description: Request body for ``POST /v1/evaluate``.
      example:
        model: typesafe/jev-1.13
        questions:
          department:
            criteria:
              billing: Payments, refunds and invoices
              technical: Bugs, outages and integration problems
            instructions: Which team should handle this ticket?
            type: choice
          needs_human:
            instructions: Probability that this needs a human reply.
            type: noul
          urgency:
            criteria:
              - Can wait a week
              - Within a day
              - Immediately
            instructions: How urgently does this need a reply?
            type: score
        state:
          plan: pro
          subject: Refund for order 4821 never arrived
    EvaluateResponse:
      properties:
        id:
          type: string
          title: Id
          description: This evaluation's id, `eval_` followed by 24 hex.
        model:
          type: string
          title: Model
          description: The model id you asked for, not the provider's.
        answers:
          patternProperties:
            ^[A-Za-z0-9_-]{1,64}$:
              oneOf:
                - $ref: '#/components/schemas/ChoiceAnswer'
                - $ref: '#/components/schemas/ScoreAnswer'
                - $ref: '#/components/schemas/NoulAnswer'
              discriminator:
                propertyName: type
                mapping:
                  choice: '#/components/schemas/ChoiceAnswer'
                  noul: '#/components/schemas/NoulAnswer'
                  score: '#/components/schemas/ScoreAnswer'
          type: object
          title: Answers
          description: One answer per question, keyed by the names you sent.
        usage:
          anyOf:
            - $ref: '#/components/schemas/EvaluateUsage'
            - type: 'null'
      type: object
      required:
        - id
        - model
        - answers
      title: EvaluateResponse
      description: Response body for ``POST /v1/evaluate``.
    EvaluateUsage:
      properties:
        input_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Input Tokens
        output_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Output Tokens
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
      type: object
      title: EvaluateUsage
      description: Tokens as the provider reported them — what the request is billed on.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) or, for the admin-keys endpoints, a
        dashboard session token — sent as `Authorization: Bearer <token>`.

````