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 budget_spent credits_spent
tier

#1427: with credits_spent, the plan of whoever pays the credits.

string
Allowed values: free personal team enterprise
credits

#1427: on Plune AI while available, what the draft will take — 2 for a prompt over 10 000 estimated tokens (a large case). With overage on, the draft stays available at no credit: its POST starts a pack.

integer
Allowed values: 1 2
provider

Present exactly when available is true.

string
Allowed values: anthropic openrouter custom plune
model

Present exactly when available is true.

string
fallback

#829: where the code goes if the primary fails. Present when available is true and a fallback is set.

object
provider
required

ADR-0004 — the ways to connect a provider on this feature; each later addition is its own task. plune (#1427): Plune AI, the platform’s own key through OpenRouter, paid for in credits — the model is the plan’s (Free a low-cost one, a paid plan Haiku 5.5), no key and no fallback of the owner’s. Only the case draft runs on it; every other AI action reads a project on plune as one with no provider connected.

string
Allowed values: anthropic openrouter custom plune
model
required
string
>= 1 characters
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
attempt

#829 (ADR 0052): which attempt of the request this record is - 1 the primary provider, 2 the fallback.

integer
Allowed values: 1 2
viaFallback

#829: true when the fallback provider made the draft. The page shows it before the member accepts.

boolean
attempts

#829: one element per attempt of the request, the first the primary. One element when only the primary was tried. Never the provider’s own text (AC-09).

Array<object>
>= 1 items <= 2 items

#829 (ADR 0052): one attempt of one request.

object
role
required
string
Allowed values: primary fallback
provider
required

ADR-0004 — the ways to connect a provider on this feature; each later addition is its own task. plune (#1427): Plune AI, the platform’s own key through OpenRouter, paid for in credits — the model is the plan’s (Free a low-cost one, a paid plan Haiku 5.5), no key and no fallback of the owner’s. Only the case draft runs on it; every other AI action reads a project on plune as one with no provider connected.

string
Allowed values: anthropic openrouter custom plune
model
required
string
>= 1 characters
outcome
required
One of:

SAD §8 rule 2 / §12. A 60s timeout is the separate aborted call state, never a value here.

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"
}