GoodMemGoodMem
ReferenceAPIREST APIDecision Models

Request decisions from a model

POST /v1/decision-models/{id}/decide: Sends the supplied questions and content to the registered provider.

Sends the supplied questions and content to the registered provider. Requires READ_DECISION_MODEL and EXECUTE_DECISION_MODEL. Each request calls the provider once and may incur charges, so do not retry automatically. GoodMem does not store the input or answers. Unsupported questions or media return 400. Problems with the stored provider credentials or settings return 412.

POST
/v1/decision-models/{id}/decide
x-api-key<token>

In: header

Path Parameters

idstring

UUID of the decision model

Header Parameters

GoodMem-Timeout-Ms?integer

Optional waiting budget in milliseconds, measured from REST servlet ingress and shared across all internal gRPC calls. Supply one decimal integer from 1 to 86400000. Omission adds no deadline. Existing shorter deadlines still apply. Expiry returns HTTP 504 before streaming starts; after streaming starts, no successful completion event is sent. Use SSE or opt into GoodMem-Stream-Terminal for an explicit terminal outcome. Retrieval work is cooperatively cancelled. An accepted mutation may still commit after timeout or disconnect; a failed response does not imply rollback.

Formatint64
Range1 <= value <= 86400000
stateDecisionContent

Content evaluated by all questions.

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

textstring | null

Ordinary text without JSON quoting.

Example"hello"

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

jsonValuestring | null

A complete JSON value encoded as a string. For example, {"jsonValue":"null"} represents JSON null. For ordinary text, use the text field.

Example"\"hello\""

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

objectValueDecisionObject | null

Object whose fields can contain nested media.

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

arrayValueDecisionArray | null

Ordered array whose elements can contain nested media.

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

mediaDecisionMedia | null

Media file included in the request. GoodMem does not download media from URLs.

Example{"mimeType":"image/png"}
attachments?array<DecisionMedia> | null

Media files included with the request. Their order is preserved within each media type.

questionsobject

Questions keyed by names that you choose. The model must support each question type and its media.

Empty Object

Response Body

curl -X POST "https://your-goodmem-server.example.com/v1/decision-models/550e8400-e29b-41d4-a716-446655440000/decide" \  -H "GoodMem-Timeout-Ms: 30000" \  -H "Content-Type: application/json" \  -d '{    "state": {      "text": "hello"    },    "attachments": [      {        "mimeType": "image/png"      }    ]  }'
{
  "model": "string",
  "answers": {
    "property1": {
      "choice": {
        "choice": "string",
        "probabilities": {
          "property1": 0.1,
          "property2": 0.1
        },
        "confidence": 0,
        "confidenceMeaning": "ADJUSTED_TOP_PROBABILITY"
      }
    },
    "property2": {
      "choice": {
        "choice": "string",
        "probabilities": {
          "property1": 0.1,
          "property2": 0.1
        },
        "confidence": 0,
        "confidenceMeaning": "ADJUSTED_TOP_PROBABILITY"
      }
    }
  },
  "usage": {
    "inputTokens": 0,
    "outputTokens": 0
  }
}
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty