Skip to content

Workspace Prompt Lab ​

Prompt Lab lets you save a prompt and preview how it is assembled with sample input. Testing returns compiled text and a token estimate. It does not generate an AI answer.

For a complete walkthrough, see Create prompt sets.

Endpoints ​

Paths are relative to https://api.chainabit.com/api/v1. Both operations require a bearer session token, membership in the workspace, and the applicable policy and plan access.

MethodPathPurposeSuccess
POST/workspaces/:workspaceId/ai/prompt-lab/templatesCreate a draft template201
POST/workspaces/:workspaceId/ai/prompt-lab/templates/:templateId/testCompile a preview201

Create Template ​

Request ​

FieldTypeRequiredDescription
namestringYesA name for the template
promptstringYesPrompt text; use where sample input belongs

The request field is prompt. The older template, variables, description, and modelId creation examples do not match this contract.

curl --fail-with-body -sS -X POST \
  "https://api.chainabit.com/api/v1/workspaces/$WORKSPACE_ID/ai/prompt-lab/templates" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Project update","prompt":"Summarize this update in two sentences: {{input}}"}'

Response ​

The following illustrates the response shape. The server supplies the identifier.

json
{
  "data": {
    "id": "<template-id>",
    "name": "Project update",
    "prompt": "Summarize this update in two sentences: {{input}}",
    "version": 1,
    "status": "draft"
  }
}

Test Template ​

Request ​

Use the creation response's data.id as TEMPLATE_ID.

FieldTypeRequiredDescription
inputstringYesText substituted for each occurrence
systemPromptstringNoAdditional instructions for the preview
memorySnippetsstring[]NoAdditional text included in the compiled context
curl --fail-with-body -sS -X POST \
  "https://api.chainabit.com/api/v1/workspaces/$WORKSPACE_ID/ai/prompt-lab/templates/$TEMPLATE_ID/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"input":"The first milestone is complete. The review is scheduled for Friday."}'

Response ​

The data object contains:

FieldMeaning
templateThe saved template with id, name, prompt, version, and status
compiledPromptThe assembled preview text
tokenEstimateA local estimate for the compiled text

Inspect compiledPrompt to confirm that the input and instructions appear as expected. The estimate is not a bill or a model response. A missing or inaccessible template returns 404.

Publishing and execution ​

This public API guide covers creating a draft and compiling its preview. It does not prescribe a publish or execution request. To have an AI respond to a prompt, follow the AI session quickstart.

Built with purpose. chainabit.com