Skip to content

Whether a draft can be requested for this case, and the current or latest relevant one

GET
/v1/test-cases/{id}/draft
curl --request GET \
--url https://beta-api.plune.ai/v1/test-cases/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft \
--header 'Authorization: Bearer <token>'

The read behind the “Draft from code” action (SCR-01) and behind SCR-02 re-reading the record after a member leaves and returns (AC-19). available is false with a reason when AI is off or no provider is connected (AC-07), the case has no code snapshot yet, or it is a manual/eval case (AC-08); platform_not_configured is the separate, operator-only condition of SAD §7/§11. pending is the newest call for this case in ANY state, or null — independent of available/reason (review F7/F8): AI being off, unreachable, or misconfigured never hides a call still waiting on a decision. For a pending call requested by somebody else, every content and cost field is withheld and mine is false (AC-19); a reader may still call this to see whether a draft exists, but never requests one (AC-06). Called by a session or a bearer token alike — reading is not restricted to a human session.

id
required
string format: uuid

Availability, and the current or latest relevant call if there is one

Media type application/json

The answer to “should the draft action show, and is anything already pending” (sad.md §6 Flow 3).

object
available
required
boolean
reason

Present exactly when available is false.

string
Allowed values: ai_disabled provider_not_connected no_code_snapshot wrong_case_type platform_not_configured
provider

Present exactly when available is true.

string
Allowed values: anthropic openrouter custom
model

Present exactly when available is true.

string
pending

The newest call for this case, in any state, or null — independent of available/reason (review F7/F8): AI being off or unreachable never hides a call still waiting on a decision.

object
id
required
string
state
required
string
Allowed values: in_progress awaiting_decision accepted rejected expired failed aborted
mine
required

Whether the caller is the member who requested this call.

boolean
requestedBy
required

userId of the member who asked — resolve through GET /v1/members like TestCaseMeta.createdBy.

string
requestedAt
required
string format: date-time
description

The drafted description, present while there is one to show (mine, and state carries text).

string
nullable
precondition
string
nullable
unseenNote

«Чого чернетка не бачила» — fixtures, hooks, helpers (AC-14). Never a field of the case.

string
nullable
codeChangedSinceRequest

Whether the case’s code snapshot changed, beyond whitespace, since this call was requested (AC-04b).

boolean
inputTokens
integer
nullable
outputTokens
integer
nullable
unitPriceUsd

The average price per token of this call (costUsd ÷ tokens) — input and output tokens are priced apart. null means “ціна невідома” (the model has no price) or that the provider reported no tokens to price; never 0 (SAD §8 rule 6, AC-15).

number
nullable
costUsd

null exactly when unitPriceUsd is null.

number
nullable
durationMs
integer
nullable
failureKind

Present exactly when state is failed.

string
Allowed values: key_rejected provider_rate_limited provider_unavailable invalid_response address_rejected
Examples

AC-01 — AI on, automated case with a snapshot, nothing pending

{
"available": true,
"provider": "anthropic",
"model": "claude-sonnet-5",
"pending": null
}

No / invalid token or session

Not found or not yours

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}