# Rename a case order

Renames a case order by ID.
- When `recursive=false` (default), `name` is required and replaces the case order's name only.
- When `recursive=true`, exactly one of `prefix` or `suffix` must be provided. The chosen affix
is applied to the case order's name and to every linked analysis name, sample internal id,
and subject internal id.

The response includes per-entity-type counts and a previous→new name mapping for the entity
types that are observable in the response (case order and analyses). Samples and subjects are
also renamed server-side when `recursive=true`, but their before/after values are not exposed
in the response.

Endpoint: POST /v1/case_order/rename
Version: 96
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `case_order_id` (integer)
    ID of the case order to rename. Mutually exclusive with `case_order_name`.
    Example: 12345

  - `case_order_name` (string)
    Current name of the case order to rename. Mutually exclusive with `case_order_id`.
    Example: Order_2024

  - `recursive` (boolean)
    When true, applies `prefix` or `suffix` to the case order, and to every linked
analysis name, sample internal id, and subject internal id.
    Example: false

  - `name` (string)
    New name for the case order. Required when `recursive` is false.
    Example: Order_2024_renamed

  - `prefix` (string)
    Prefix to prepend to entity names. Used only when `recursive` is true. Mutually exclusive with `suffix`.
    Example: REVIEWED_

  - `suffix` (string)
    Suffix to append to entity names. Used only when `recursive` is true. Mutually exclusive with `prefix`.
    Example: _v2

## Response 200:

  - `200` (unknown)
    Rename completed (check `success` and `error` for outcome)

## Response 200 fields (application/json):

  - `success` (boolean, required)
    Whether the rename succeeded.
    Example: true

  - `error` (string)
    Error message when `success` is false.
    Example: null

  - `summaries` (array, required)
    Per-entity-type rename summary. Includes one entry for `case_order` and, when
`recursive` is true, one entry for `analysis`. Samples and subjects are also
renamed when `recursive` is true but their before/after names are not exposed.

  - `summaries.entity_type` (string, required)
    Entity type that was renamed.
    Enum: "case_order", "analysis"

  - `summaries.count` (integer, required)
    Number of entities of this type that were renamed.
    Example: 3

  - `summaries.renames` (array, required)
    Previous-to-new name mapping for each renamed entity of this type.

  - `summaries.renames.prev_name` (string, required)
    Name before the rename.
    Example: Order_2024

  - `summaries.renames.new_name` (string, required)
    Name after the rename.
    Example: REVIEWED_Order_2024

## Response 400:

  - `400` (unknown)
    Bad request - invalid input

## Response 400 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 401:

  - `401` (unknown)
    Authentication failed - invalid or missing token

## Response 401 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 404:

  - `404` (unknown)
    Resource not found

## Response 404 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 429:

  - `429` (unknown)
    Rate limit exceeded

## Response 429 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 429 headers (application/json):

  - `Retry-After` (integer)
    Number of seconds to wait before retrying

