---
title: "Save a session as a test case"
method: POST
path: "/api/sessions/{sessionId}/save-as-case"
tags: ["Test Cases"]
---

# Save a session as a test case

`POST /api/sessions/{sessionId}/save-as-case`

## Request

- Base URL: `https://aximo.autify.com`
- URL: `https://aximo.autify.com/api/sessions/{sessionId}/save-as-case`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/autify/apis/aximo-api/docs/api/sessions/:sessionId/save-as-case/post.ts> (a function with typed inputs; its response is checked against the schema)

Persists a finished agent session as a reusable test case and links the two.
The session must be in a terminal state (`succeeded`, `failed`, `terminated`,
`error`) and not already linked to a case. The scenario defaults to the
session summary; mobile, web and local desktop run configuration is carried over automatically.

The created case has **API access enabled by default**, so it can be triggered
immediately with `POST /api/triggers/cases/{caseId}/run`.

## Path parameters

- `sessionId` string, uuid, required

## Request body

- object
  - `title` string: Case title. Defaults to the session title.
  - `type` 'web' | 'mobile' | 'desktop': Case type. Inferred from the session if omitted. A session on a registered local desktop saves as `desktop` bound to that desktop, and a cloud desktop session as `web`.
  - `scenario` string: Scenario text. Defaults to the session summary.
  - `format` 'gherkin' | 'markdown' | 'plain_text': Scenario format.

## Response `201`

Case created from the session.

- object
  - `success` boolean, required
  - `caseId` string, uuid, required
  - `projectId` string, uuid, required
  - `unregisteredPlaceholders` UnregisteredPlaceholders: Advisory, present only when the scenario references `{{VARIABLE}}`, OTP or file placeholders the workspace has not registered. The case is created regardless.
    - `variables` string[], required
    - `otps` string[], required
    - `files` string[], required
  - `embeddedCode` EmbeddedCodeAdvisory: Advisory, present only when the scenario contains embedded code (scripts, shell commands or fenced blocks). The case is created regardless.
    - `kinds` string[], required
    - `emailRelated` boolean, required
    - `suggestEmailTestingContact` boolean, required

## Other responses

- `400`: Session is not in a terminal state, is already linked to a case, has no project, has no summary and no scenario was provided, or `type` does not fit the local device it ran on (a local desktop saves as `desktop` or `web`, a local phone as `mobile` or `web`).
- `401`: Missing or invalid API key.
- `404`: Session not found.
- `429`: Rate limit exceeded — e.g. the daily session limit was reached for the organization, or too many API requests were sent in a short window (retry after the number of seconds in the `Retry-After` header).
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/autify/apis/aximo-api.md) - [All operations](https://skmtc.dev/autify/apis/aximo-api/llms.txt) - [OpenAPI document](https://skmtc.dev/autify/apis/aximo-api/revisions/590722011284?raw)
