> For the complete documentation index, see [llms.txt](https://docs.enlyze.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enlyze.com/en/enlyze-api/api-reference/downtime-reasons.md).

# Downtime Reasons

⚠️ **Experimental** — this resource is under active development and may change without notice.

## Get Downtime Reasons

> Returns a list of downtime reasons in your organization.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"DowntimeCategory":{"type":"string","enum":["PLANNED","UNPLANNED","NOT_SCHEDULED","INVALID"],"title":"DowntimeCategory"},"DowntimeReasonState":{"type":"string","enum":["active","archived"],"title":"DowntimeReasonState"},"PaginatedDowntimeReasons":{"properties":{"data":{"items":{"$ref":"#/components/schemas/DowntimeReason"},"type":"array","title":"Data"},"metadata":{"$ref":"#/components/schemas/Metadata","description":"This field contains pagination metadata."}},"additionalProperties":false,"type":"object","required":["data","metadata"],"title":"PaginatedDowntimeReasons"},"DowntimeReason":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Downtime Reason UUID","description":"The UUID of the downtime reason."},"name":{"type":"string","title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"Category of the downtime reason."},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state of the downtime reason."},"catalog":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Catalog","description":"UUID of the catalog this reason belongs to. Resolve it via `GET /api/v2/downtime-catalogs/{uuid}`. `null` for legacy reasons not yet migrated to a catalog (only reachable as an embedded reason on `GET /api/v2/downtimes`)."}},"type":"object","required":["uuid","name","category","group","state"],"title":"DowntimeReason"},"Metadata":{"properties":{"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Pagination continuation point. Specify its value as the `cursor` parameter in a request with otherwise the same parameters to fetch the next page. `None`, if there is no more data to be fetched from the server."}},"additionalProperties":false,"type":"object","required":["next_cursor"],"title":"Metadata"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons":{"get":{"tags":["Downtime Reasons"],"summary":"Get Downtime Reasons","description":"Returns a list of downtime reasons in your organization.","operationId":"get_downtime_reasons_v2_downtime_reasons_get","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string","title":"Get page starting at cursor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"title":"Maximum number of results to return","description":"Caps the page size. Defaults to 1000, which is also the maximum; a value below 1 or above 1000 is rejected.","default":1000},"description":"Caps the page size. Defaults to 1000, which is also the maximum; a value below 1 or above 1000 is rejected."},{"name":"uuid","in":"query","required":false,"schema":{"anyOf":[{"type":"array","uniqueItems":true,"items":{"type":"string","format":"uuid"},"maxItems":50},{"type":"null"}],"title":"Filter by one or more downtime reason UUIDs.","description":"If not set, all downtime reasons will be considered."},"description":"If not set, all downtime reasons will be considered."},{"name":"catalog","in":"query","required":false,"schema":{"anyOf":[{"type":"array","uniqueItems":true,"items":{"type":"string","format":"uuid"},"maxItems":50},{"type":"null"}],"title":"Filter by one or more downtime catalog UUIDs.","description":"Only return reasons belonging to any of the given catalogs."},"description":"Only return reasons belonging to any of the given catalogs."},{"name":"machine","in":"query","required":false,"schema":{"anyOf":[{"type":"array","uniqueItems":true,"items":{"type":"string","format":"uuid"},"maxItems":50},{"type":"null"}],"title":"Filter by one or more machine UUIDs.","description":"Only return reasons whose catalog is assigned to every one of the given machines, i.e. the reasons that can label downtimes on all of them. Unknown or deleted machines are ignored; if none of the given machines exists, no reasons are returned. If not set, reasons for all machines will be considered."},"description":"Only return reasons whose catalog is assigned to every one of the given machines, i.e. the reasons that can label downtimes on all of them. Unknown or deleted machines are ignored; if none of the given machines exists, no reasons are returned. If not set, reasons for all machines will be considered."},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"array","uniqueItems":true,"items":{"$ref":"#/components/schemas/DowntimeCategory"},"maxItems":50},{"type":"null"}],"title":"Filter by one or more downtime categories.","description":"If not set, all categories will be considered."},"description":"If not set, all categories will be considered."},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/DowntimeReasonState"},{"type":"null"}],"title":"Filter by lifecycle state.","description":"If not set, both active and archived reasons will be returned."},"description":"If not set, both active and archived reasons will be returned."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDowntimeReasons"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Downtime Reason

> Create a downtime reason within a catalog.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"CreateDowntimeReason":{"properties":{"uuid":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Reason UUID","description":"UUID to create the reason with; generated if omitted. If a reason with this UUID already exists, the create is rejected with a `uuid_collision` naming it."},"catalog":{"type":"string","format":"uuid","title":"Downtime Catalog","description":"UUID of the active catalog to create the reason in."},"name":{"type":"string","minLength":1,"title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"One of: PLANNED, UNPLANNED, NOT_SCHEDULED, INVALID"},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group","description":"Single-level, free-text group the reason belongs to."}},"type":"object","required":["catalog","name","category"],"title":"CreateDowntimeReason"},"DowntimeCategory":{"type":"string","enum":["PLANNED","UNPLANNED","NOT_SCHEDULED","INVALID"],"title":"DowntimeCategory"},"DowntimeReason":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Downtime Reason UUID","description":"The UUID of the downtime reason."},"name":{"type":"string","title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"Category of the downtime reason."},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state of the downtime reason."},"catalog":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Catalog","description":"UUID of the catalog this reason belongs to. Resolve it via `GET /api/v2/downtime-catalogs/{uuid}`. `null` for legacy reasons not yet migrated to a catalog (only reachable as an embedded reason on `GET /api/v2/downtimes`)."}},"type":"object","required":["uuid","name","category","group","state"],"title":"DowntimeReason"},"DowntimeReasonState":{"type":"string","enum":["active","archived"],"title":"DowntimeReasonState"},"CatalogNotFoundError":{"properties":{"type":{"type":"string","const":"catalog_not_found","title":"Type","default":"catalog_not_found"}},"type":"object","title":"CatalogNotFoundError"},"CatalogArchivedError":{"properties":{"type":{"type":"string","const":"archived_catalog","title":"Type","default":"archived_catalog"}},"type":"object","title":"CatalogArchivedError"},"ReasonUuidCollisionError":{"properties":{"type":{"type":"string","const":"uuid_collision","title":"Type","default":"uuid_collision"},"conflict":{"$ref":"#/components/schemas/ConflictingReason","title":"Conflicting Reason","description":"The reason already holding the UUID; when its `state` is `archived`, restore it to use it again."}},"type":"object","required":["conflict"],"title":"ReasonUuidCollisionError"},"ConflictingReason":{"properties":{"reason":{"type":"string","format":"uuid","title":"Conflicting Reason UUID"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Conflicting Reason State","description":"Lifecycle state of the conflicting reason."}},"type":"object","required":["reason","state"],"title":"ConflictingReason"},"ReasonNameCollisionError":{"properties":{"type":{"type":"string","const":"name_collision","title":"Type","default":"name_collision"},"conflict":{"$ref":"#/components/schemas/ConflictingReason","title":"Conflicting Reason","description":"The reason already occupying the slot; when its `state` is `archived`, restoring it is an alternative to creating a new one."}},"type":"object","required":["conflict"],"title":"ReasonNameCollisionError"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons":{"post":{"tags":["Downtime Reasons"],"summary":"Create Downtime Reason","description":"Create a downtime reason within a catalog.","operationId":"create_downtime_reason_v2_downtime_reasons_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDowntimeReason"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowntimeReason"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CatalogNotFoundError"}],"discriminator":{"propertyName":"type","mapping":{"catalog_not_found":"#/components/schemas/CatalogNotFoundError"}},"title":"Response 404 Create Downtime Reason V2 Downtime Reasons Post"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CatalogArchivedError"},{"$ref":"#/components/schemas/ReasonUuidCollisionError"},{"$ref":"#/components/schemas/ReasonNameCollisionError"}],"discriminator":{"propertyName":"type","mapping":{"archived_catalog":"#/components/schemas/CatalogArchivedError","uuid_collision":"#/components/schemas/ReasonUuidCollisionError","name_collision":"#/components/schemas/ReasonNameCollisionError"}},"title":"Response 409 Create Downtime Reason V2 Downtime Reasons Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Downtime Reason

> Returns details for a specific downtime reason.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"DowntimeReason":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Downtime Reason UUID","description":"The UUID of the downtime reason."},"name":{"type":"string","title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"Category of the downtime reason."},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state of the downtime reason."},"catalog":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Catalog","description":"UUID of the catalog this reason belongs to. Resolve it via `GET /api/v2/downtime-catalogs/{uuid}`. `null` for legacy reasons not yet migrated to a catalog (only reachable as an embedded reason on `GET /api/v2/downtimes`)."}},"type":"object","required":["uuid","name","category","group","state"],"title":"DowntimeReason"},"DowntimeCategory":{"type":"string","enum":["PLANNED","UNPLANNED","NOT_SCHEDULED","INVALID"],"title":"DowntimeCategory"},"DowntimeReasonState":{"type":"string","enum":["active","archived"],"title":"DowntimeReasonState"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons/{uuid}":{"get":{"tags":["Downtime Reasons"],"summary":"Get Downtime Reason","description":"Returns details for a specific downtime reason.","operationId":"get_downtime_reason_v2_downtime_reasons__uuid__get","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The UUID of the downtime reason."}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowntimeReason"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Downtime Reason

> Delete a downtime reason. Downtimes labeled with it are kept, but lose their reason. Works on active and archived reasons. Pass \`dry\_run=true\` to see how many downtimes would be affected, without deleting anything.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"DowntimeReasonDeleteResult":{"properties":{"unlabeled_downtimes":{"type":"integer","title":"Unlabeled Downtimes","description":"Number of downtimes that lose their reason; the downtimes themselves are kept (a dry run reports how many would be unlabeled)."}},"type":"object","required":["unlabeled_downtimes"],"title":"DowntimeReasonDeleteResult"},"ReasonNotFoundError":{"properties":{"type":{"type":"string","const":"reason_not_found","title":"Type","default":"reason_not_found"}},"type":"object","title":"ReasonNotFoundError"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons/{uuid}":{"delete":{"tags":["Downtime Reasons"],"summary":"Delete Downtime Reason","description":"Delete a downtime reason. Downtimes labeled with it are kept, but lose their reason. Works on active and archived reasons. Pass `dry_run=true` to see how many downtimes would be affected, without deleting anything.","operationId":"delete_downtime_reason_v2_downtime_reasons__uuid__delete","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The UUID of the downtime reason."}},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","title":"Preview the delete without applying it.","description":"If true, nothing is deleted; the response reports what a real delete would affect.","default":false},"description":"If true, nothing is deleted; the response reports what a real delete would affect."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowntimeReasonDeleteResult"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ReasonNotFoundError"}],"discriminator":{"propertyName":"type","mapping":{"reason_not_found":"#/components/schemas/ReasonNotFoundError"}},"title":"Response 404 Delete Downtime Reason V2 Downtime Reasons  Uuid  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Update Downtime Reason

> Update a downtime reason's name, description, or group.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"UpdateDowntimeReason":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Group"}},"type":"object","title":"UpdateDowntimeReason"},"DowntimeReason":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Downtime Reason UUID","description":"The UUID of the downtime reason."},"name":{"type":"string","title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"Category of the downtime reason."},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state of the downtime reason."},"catalog":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Catalog","description":"UUID of the catalog this reason belongs to. Resolve it via `GET /api/v2/downtime-catalogs/{uuid}`. `null` for legacy reasons not yet migrated to a catalog (only reachable as an embedded reason on `GET /api/v2/downtimes`)."}},"type":"object","required":["uuid","name","category","group","state"],"title":"DowntimeReason"},"DowntimeCategory":{"type":"string","enum":["PLANNED","UNPLANNED","NOT_SCHEDULED","INVALID"],"title":"DowntimeCategory"},"DowntimeReasonState":{"type":"string","enum":["active","archived"],"title":"DowntimeReasonState"},"ReasonNotFoundError":{"properties":{"type":{"type":"string","const":"reason_not_found","title":"Type","default":"reason_not_found"}},"type":"object","title":"ReasonNotFoundError"},"ReasonArchivedError":{"properties":{"type":{"type":"string","const":"archived_reason","title":"Type","default":"archived_reason"}},"type":"object","title":"ReasonArchivedError"},"ReasonNameCollisionError":{"properties":{"type":{"type":"string","const":"name_collision","title":"Type","default":"name_collision"},"conflict":{"$ref":"#/components/schemas/ConflictingReason","title":"Conflicting Reason","description":"The reason already occupying the slot; when its `state` is `archived`, restoring it is an alternative to creating a new one."}},"type":"object","required":["conflict"],"title":"ReasonNameCollisionError"},"ConflictingReason":{"properties":{"reason":{"type":"string","format":"uuid","title":"Conflicting Reason UUID"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Conflicting Reason State","description":"Lifecycle state of the conflicting reason."}},"type":"object","required":["reason","state"],"title":"ConflictingReason"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons/{uuid}":{"patch":{"tags":["Downtime Reasons"],"summary":"Update Downtime Reason","description":"Update a downtime reason's name, description, or group.","operationId":"update_downtime_reason_v2_downtime_reasons__uuid__patch","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The UUID of the downtime reason."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDowntimeReason"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowntimeReason"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ReasonNotFoundError"}],"discriminator":{"propertyName":"type","mapping":{"reason_not_found":"#/components/schemas/ReasonNotFoundError"}},"title":"Response 404 Update Downtime Reason V2 Downtime Reasons  Uuid  Patch"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ReasonArchivedError"},{"$ref":"#/components/schemas/ReasonNameCollisionError"}],"discriminator":{"propertyName":"type","mapping":{"archived_reason":"#/components/schemas/ReasonArchivedError","name_collision":"#/components/schemas/ReasonNameCollisionError"}},"title":"Response 409 Update Downtime Reason V2 Downtime Reasons  Uuid  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Set Downtime Reason State

> Archive or restore a downtime reason. A reason in an archived catalog can only be restored by restoring its catalog. Setting the state the reason is already in is a no-op.

```json
{"openapi":"3.1.0","info":{"title":"ENLYZE API","version":"v2"},"tags":[{"name":"Downtime Reasons","description":"⚠️ **Experimental** — this resource is under active development and may change without notice."}],"servers":[{"url":"/api"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"UpdateDowntimeReasonStateRequest":{"properties":{"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state to transition the reason to."}},"type":"object","required":["state"],"title":"UpdateDowntimeReasonStateRequest"},"DowntimeReasonState":{"type":"string","enum":["active","archived"],"title":"DowntimeReasonState"},"DowntimeReason":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Downtime Reason UUID","description":"The UUID of the downtime reason."},"name":{"type":"string","title":"Downtime Reason Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Description","description":"Free-text description of the downtime reason."},"category":{"$ref":"#/components/schemas/DowntimeCategory","title":"Downtime Reason Category","description":"Category of the downtime reason."},"group":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downtime Reason Group"},"state":{"$ref":"#/components/schemas/DowntimeReasonState","title":"Downtime Reason State","description":"Lifecycle state of the downtime reason."},"catalog":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Downtime Catalog","description":"UUID of the catalog this reason belongs to. Resolve it via `GET /api/v2/downtime-catalogs/{uuid}`. `null` for legacy reasons not yet migrated to a catalog (only reachable as an embedded reason on `GET /api/v2/downtimes`)."}},"type":"object","required":["uuid","name","category","group","state"],"title":"DowntimeReason"},"DowntimeCategory":{"type":"string","enum":["PLANNED","UNPLANNED","NOT_SCHEDULED","INVALID"],"title":"DowntimeCategory"},"ReasonNotFoundError":{"properties":{"type":{"type":"string","const":"reason_not_found","title":"Type","default":"reason_not_found"}},"type":"object","title":"ReasonNotFoundError"},"CatalogArchivedError":{"properties":{"type":{"type":"string","const":"archived_catalog","title":"Type","default":"archived_catalog"}},"type":"object","title":"CatalogArchivedError"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/downtime-reasons/{uuid}/state":{"put":{"tags":["Downtime Reasons"],"summary":"Set Downtime Reason State","description":"Archive or restore a downtime reason. A reason in an archived catalog can only be restored by restoring its catalog. Setting the state the reason is already in is a no-op.","operationId":"set_downtime_reason_state_v2_downtime_reasons__uuid__state_put","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"The UUID of the downtime reason."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDowntimeReasonStateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DowntimeReason"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ReasonNotFoundError"}],"discriminator":{"propertyName":"type","mapping":{"reason_not_found":"#/components/schemas/ReasonNotFoundError"}},"title":"Response 404 Set Downtime Reason State V2 Downtime Reasons  Uuid  State Put"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CatalogArchivedError"}],"discriminator":{"propertyName":"type","mapping":{"archived_catalog":"#/components/schemas/CatalogArchivedError"}},"title":"Response 409 Set Downtime Reason State V2 Downtime Reasons  Uuid  State Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```
