Graine AI
API referenceAgent versions

Delete an A/B experiment

Delete an A/B experiment permanently.

Delete an A/B experiment permanently.

This is a hard delete, unlike DELETE /v2/agents/{agent_id}, which archives. The experiment record is removed; the two agents it referenced are untouched and keep their call history.

An ACTIVE experiment cannot be deleted — pause or conclude it first, or this returns 409 (code 1201). Draft, paused and concluded experiments delete cleanly. Deleting a concluded experiment also deletes the record of which variant won, so conclude-and-keep is usually the better ending.

Returns 204 with an empty body.

Rate limit: 1000 requests per minute per organization (bucket default). Exceeding it returns 429 with Retry-After; the X-RateLimit-* response headers report your remaining allowance on every call.

DELETE
/v2/agents/{agent_id}/versions/{version_id}
/v2/agents/6c6f4cc3-f56c-479d-8422-7f76694daa29/versions/9f1c0f7e-1f2a-4c3b-8a11-2c6a0a5f8d10

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Your Graine API key. Create one in the dashboard under Developers, or via POST /v2/api-keys. Send it as Authorization: Bearer <key>.

In: header

Path Parameters

agent_id
Required
Agent Id

The CONTROL agent.

version_id
Required
Version Id

Experiment identifier.

Query Parameters

organization_idOrganization Id

Must match the organisation the API key belongs to.

Response Body

400

1000 — malformed or contradictory input: an unknown status token, an empty patch body, an explicit null, or a variant agent that does not exist in this organisation.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

401

1100 — missing, unknown or inactive API key. 1101 — a browser session token was presented.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

403

1102 — the key is valid but lacks the scope this endpoint requires, or names another organisation. GET /v2/scopes reports which scopes the key holds.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

404

1200 — no such agent, or no such version for that agent, in this organisation. Cross-tenant reads answer 404, never 403, so ids cannot be probed.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

409

1201 — the experiment's state does not allow this action: a second ACTIVE version for the same control agent, a DELETE against an ACTIVE version, or a winner set before the experiment is concluded.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

422

1001 — the body or query failed validation; the message names the first offending field.

error
Required
integer

Stable integer code from the error table. Branch on this, not on the message.

message
Required
string

One human-readable sentence. Wording may change; the code will not.

429

1300 — per-organisation rate limit exceeded. Carries Retry-After.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

503

1501 — the agent service is unreachable or returned a 5xx.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

504

1502 — the agent service did not respond in time.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

curl -X DELETE "https://api.graine.ai/v2/agents/6c6f4cc3-f56c-479d-8422-7f76694daa29/versions/9f1c0f7e-1f2a-4c3b-8a11-2c6a0a5f8d10?organization_id=string" \
  -H "Authorization: Bearer <token>"

Deleted. The response body is empty.