API Reference

List variables

Returns the values the live prompt expects, without resolving anything.

GEThttps://api.promptengine.co.in/v1/engines/{engine_id}/variables

Parameters

FieldInTypeDescription
engine_idpathintegerWhich engine to read.

The response

Every field is always present, and always the same type. None of them are conditional on the kind of prompt that happens to be live:

json
{
  "success": true,
  "data": {
    "version": "2.1",
    "mode": "text",
    "variables": [
      { "name": "product" },
      { "name": "ticket_body" }
    ]
  },
  "error": null
}

Everything above sits under data:

FieldTypeDescription
variablesarrayEvery placeholder the live prompt declares, as { name } objects — the same shape as missing_variables on the resolve endpoint. Always an array: empty, never null, when the prompt takes none.
versionstringWhich version these variables belong to.
modestring | nullSame meaning as on the resolve endpoint.

When to use it

Resolving a prompt never fails because of a missing value — the placeholder is just left empty. That is the right default for a live request, but it means a mismatch between what your code sends and what the prompt expects can go unnoticed. This endpoint is how you notice.

Two things it is good for:

  • A startup check. Call it once on boot and compare against the keys you intend to send. A prompt that gained a variable since your last deploy shows up immediately instead of quietly resolving to a blank.
  • Building a form. If a human fills in the values, this is the list of inputs to render.

It reads the same live prompt as Get active prompt and fails the same ways — an engine with nothing activated returns 404 here too.

Examples

Real responses, captured from the API — not written by hand.

Plain template

Three placeholders, in the order they were declared.

json
{
  "success": true,
  "data": {
    "version": "1.0",
    "mode": null,
    "variables": [
      { "name": "company" },
      { "name": "customer_name" },
      { "name": "tone" }
    ]
  },
  "error": null
}

Kitchen prompt

Variables are collected across the whole prompt, system message included.

json
{
  "success": true,
  "data": {
    "version": "1.0",
    "mode": "text",
    "variables": [
      { "name": "product" },
      { "name": "ticket_body" }
    ]
  },
  "error": null
}

Errors

What this endpoint can return. The envelope is the same everywhere — see Errors for the shape and how to handle it.

Try it

Calls the real endpoint, exactly as your backend would. Paste an API key to run it.

The same call, in code

Updates as you edit the form below. Set PROMPT_ENGINE_KEY in your environment — don't paste the key into your source.

curl https://api.promptengine.co.in/v1/engines/{engine_id}/variables \
  -H "Authorization: Bearer $PROMPT_ENGINE_KEY"