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.
| Method | Path | Purpose | Success |
|---|---|---|---|
| POST | /workspaces/:workspaceId/ai/prompt-lab/templates | Create a draft template | 201 |
| POST | /workspaces/:workspaceId/ai/prompt-lab/templates/:templateId/test | Compile a preview | 201 |
Create Template
Request
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A name for the template |
prompt | string | Yes | Prompt 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.
{
"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.
| Field | Type | Required | Description |
|---|---|---|---|
input | string | Yes | Text substituted for each occurrence |
systemPrompt | string | No | Additional instructions for the preview |
memorySnippets | string[] | No | Additional 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:
| Field | Meaning |
|---|---|
template | The saved template with id, name, prompt, version, and status |
compiledPrompt | The assembled preview text |
tokenEstimate | A 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.