{
  "openapi": "3.1.0",
  "info": {
    "title": "bricksta API",
    "version": "1.0.0",
    "description": "Read cases, tasks with their fields, templates, members and roles of your organization, create cases, save task values and finish tasks, with an API key. The key acts as its API account: it sees and does exactly what that account may. Rate limit: 120 reads and 30 writes per minute per key, at most 4 concurrent requests per key."
  },
  "externalDocs": {
    "description": "Guide",
    "url": "https://bricksta.com/en/docs/api"
  },
  "servers": [
    {
      "url": "/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Cases"
    },
    {
      "name": "Tasks"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Members"
    }
  ],
  "paths": {
    "/tasks": {
      "get": {
        "operationId": "listTasks",
        "tags": [
          "Tasks"
        ],
        "summary": "Fetch and lock open and in-progress tasks",
        "description": "Open and in-progress tasks the API account may work on (task.edit or task.complete), in cases it can see, oldest opened first. Fetching locks: every task in the answer carries `lock_token`, `lock_expires_at` and `run_no`, and no other fetch gets it until the lock expires — so several instances of your integration never work on the same task. A page may hold fewer tasks than `limit` when another instance fetches at the same moment; page through with `cursor` until `next_cursor` is null. Send `lock_token` and `run_no` with your writes. A lock is not extended: fetch again after it expired (you may get the task back with a new `lock_token`). Pair it with the webhook event `task_ready`, which fires when a task opens — only the transition, and only while the webhook is active, so keep fetching to reconcile. The lock binds API keys only; people in Bricksta can still work on the task.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1–100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "example": 50
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from `next_cursor` of the previous page. Do not build or change it.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "lock_duration",
            "in": "query",
            "required": false,
            "description": "Lock duration in seconds, 10–3600.",
            "schema": {
              "type": "integer",
              "minimum": 10,
              "maximum": 3600
            },
            "example": 600
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "case_id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "name": {
                            "description": "Task name: for a task from the template, the step name in the template version the case runs on (renaming the step in the draft does not change it); for an ad-hoc task, its own name. null only if neither exists.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "in_progress"
                            ]
                          },
                          "run_no": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "description": "Current run of the task; a backjump starts a new run."
                          },
                          "due_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "due_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lock_token": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                            "description": "Send it with PUT /tasks/{id}/values/{field_id} and POST /tasks/{id}/complete."
                          },
                          "lock_expires_at": {
                            "type": "string",
                            "description": "Until then no other fetch gets this task."
                          }
                        },
                        "required": [
                          "id",
                          "case_id",
                          "name",
                          "status",
                          "run_no",
                          "due_date",
                          "due_at",
                          "lock_token",
                          "lock_expires_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16",
                      "case_id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                      "name": "Check invoice",
                      "status": "open",
                      "run_no": 1,
                      "due_date": "2026-11-27",
                      "due_at": null,
                      "lock_token": "0f5b2e8d-7a3c-4d91-b6f4-2c8e9a1d7b53",
                      "lock_expires_at": "2026-11-23T10:10:00.214733+00:00"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/cases": {
      "get": {
        "operationId": "listCases",
        "tags": [
          "Cases"
        ],
        "summary": "List cases",
        "description": "Cases of your organization that the API account can see, oldest change first. Page through with `cursor` until `next_cursor` is null. Delivery is at-least-once: a case changed while you page may appear again — match by `id`. The newest changes (last 30 seconds) appear on a later call.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1–100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "example": 2
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from `next_cursor` of the previous page. Do not build or change it.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "description": "Only cases changed at or after this ISO 8601 timestamp. For a running sync pass the largest `updated_at` of your last response, not the time of your call.",
            "schema": {
              "type": "string",
              "maxLength": 40,
              "pattern": "^\\d{4}-\\d{2}-\\d{2}"
            },
            "example": "2026-11-20T00:00:00Z"
          },
          {
            "name": "template",
            "in": "query",
            "required": false,
            "description": "Only cases of this template (ID from GET /templates).",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only cases with this status. No default filter.",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "completed",
                "cancelled"
              ]
            },
            "example": "active"
          },
          {
            "name": "field",
            "in": "query",
            "required": false,
            "description": "Field label to filter by, e.g. an ERP number. Requires `value`.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": false,
            "description": "Value of `field` (case-insensitive exact match). Only fields visible to the account count.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "active",
                              "completed",
                              "cancelled"
                            ]
                          },
                          "template_id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "due_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string",
                            "description": "Last change of the case or one of its tasks or field values."
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "title",
                          "status",
                          "template_id",
                          "due_date",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                      "number": 1042,
                      "title": "Order 4711",
                      "status": "active",
                      "template_id": "3f6c2a9e-0b1d-4c7e-9a52-6d8e1f4b2c70",
                      "due_date": "2026-11-30",
                      "created_at": "2026-11-21T08:14:03.512904+00:00",
                      "updated_at": "2026-11-22T15:40:11.078331+00:00"
                    },
                    {
                      "id": "2a8d5f3c-9e1b-4c67-a4d0-6b9f2e7c1a85",
                      "number": 1043,
                      "title": "Order 4712",
                      "status": "active",
                      "template_id": "3f6c2a9e-0b1d-4c7e-9a52-6d8e1f4b2c70",
                      "due_date": null,
                      "created_at": "2026-11-22T09:02:47.330115+00:00",
                      "updated_at": "2026-11-22T16:05:52.901467+00:00"
                    }
                  ],
                  "next_cursor": "djF8MjAyNi0xMS0yMlQxNjowNTo1Mi45MDE0NjdafDJhOGQ1ZjNjLTllMWItNGM2Ny1hNGQwLTZiOWYyZTdjMWE4NQ"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createCase",
        "tags": [
          "Cases"
        ],
        "summary": "Create and start a case",
        "description": "Creates a case from a template and starts it right away (never a draft). Side effects as in the app: the first tasks open, assignees are notified, and webhooks fire. Requires the header `Idempotency-Key`: the same key under the same API key returns the same case for 24 hours instead of creating a second one; the same key with a different body answers 422 `idempotency_key_reused`. A failed attempt is not remembered — retry with the same key. Templates that need a workflow choice (non-empty `workflows` in GET /templates) need `workflow_id`: without it the answer is 422 `workflow_choice_required` and lists the `workflows`; a workflow that is not one of them answers 422 `workflow_not_selectable`. The API account needs the rights to create cases of this template, to select its workflow and, for `fields`, to edit task fields; another `owner_id` needs the right to set the owner.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your own unique key for this request (8–128 characters: letters, digits, . _ : -). Retry with the SAME key after a timeout or 409/503/504 — the API then returns the first result instead of acting twice. Valid 24 hours.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "example": "erp-order-4711"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string",
                    "maxLength": 100,
                    "format": "uuid",
                    "description": "Template ID from GET /templates. Unknown or not visible: 404."
                  },
                  "title": {
                    "description": "Case title. Empty: the template's naming rule applies.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "priority": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "low",
                          "normal",
                          "high",
                          "urgent"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "due_at": {
                    "description": "Due date of the case, ISO 8601 date or timestamp.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40,
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "owner_id": {
                    "description": "Membership ID of the owner (an active member, see GET /members). Default: the default owner of the API key, else the API account. A deactivated member returns 422 `member_inactive`, an unknown ID 422 `unprocessable`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fields": {
                    "description": "Values for the fields asked on creation. Required fields of later tasks stay open.",
                    "anyOf": [
                      {
                        "maxItems": 200,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                              "description": "Field ID from `create_fields` of GET /templates."
                            },
                            "text": {
                              "description": "Text, email, phone, URL and similar fields.",
                              "type": "string"
                            },
                            "number": {
                              "description": "Number and currency fields.",
                              "type": "number"
                            },
                            "boolean": {
                              "description": "Yes/no fields.",
                              "type": "boolean"
                            },
                            "date": {
                              "description": "Date fields, ISO 8601 (YYYY-MM-DD).",
                              "type": "string"
                            },
                            "option_id": {
                              "description": "Selection fields: option ID from `options`.",
                              "type": "string",
                              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                            }
                          },
                          "required": [
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "workflow_id": {
                    "description": "Workflow to start, one of `workflows` in GET /templates. Only for templates that need a workflow choice; otherwise 422 `workflow_not_selectable`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "template_id"
                ],
                "additionalProperties": false
              },
              "example": {
                "template_id": "3f6c2a9e-0b1d-4c7e-9a52-6d8e1f4b2c70",
                "title": "Order 4711",
                "workflow_id": "8a1e5d20-7c43-4f9b-b6e2-0d5a9c3f1e84",
                "owner_id": "6a4d9f2b-8c1e-4b73-a5d0-3e7f1c9b8a26",
                "fields": [
                  {
                    "id": "5d9e2c71-a8b4-4f36-9e01-7b3c6a2d8f15",
                    "text": "4711"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (or the earlier result for the same Idempotency-Key)",
            "headers": {
              "Location": {
                "description": "URL of the new case.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "completed",
                        "cancelled"
                      ]
                    },
                    "template_id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "due_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "owner_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "title",
                    "status",
                    "template_id",
                    "due_date",
                    "owner_id",
                    "created_at"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                  "number": 1042,
                  "title": "Order 4711",
                  "status": "active",
                  "template_id": "3f6c2a9e-0b1d-4c7e-9a52-6d8e1f4b2c70",
                  "due_date": null,
                  "owner_id": "6a4d9f2b-8c1e-4b73-a5d0-3e7f1c9b8a26",
                  "created_at": "2026-11-21T08:14:03.512904+00:00"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`conflict`, `idempotency_in_progress`, `task_blocked`, `task_not_open`, `case_not_active`, `task_in_approval`, `task_locked`, `run_mismatch`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "`payload_too_large`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`unprocessable`, `idempotency_key_reused`, `workflow_choice_required`, `workflow_not_selectable`, `member_inactive`, `required_fields_missing`, `invalid_value`, `completion_rejected`, `template_not_published`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "example": {
                  "type": "https://bricksta.com/en/docs/api#workflow_choice_required",
                  "title": "This template needs a workflow choice: send workflow_id (see workflows).",
                  "status": 422,
                  "code": "workflow_choice_required",
                  "workflows": [
                    {
                      "id": "8a1e5d20-7c43-4f9b-b6e2-0d5a9c3f1e84",
                      "name": "Standard"
                    },
                    {
                      "id": "c2b7f915-3e6a-4d08-a1c4-9f2e6b8d0a37",
                      "name": "Rush order"
                    }
                  ]
                }
              }
            }
          },
          "423": {
            "description": "`read_only`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "`outcome_unknown`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/cases/{id}": {
      "get": {
        "operationId": "getCase",
        "tags": [
          "Cases"
        ],
        "summary": "Get a case",
        "description": "One case with its visible field values and ALL tasks (open and done). An ID of another organization or a case the account cannot see answers 404, identical to an unknown ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tasks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "name": {
                            "description": "Task name: for a task from the template, the step name in the template version the case runs on (renaming the step in the draft does not change it); for an ad-hoc task, its own name. null only if neither exists.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "waiting",
                              "open",
                              "in_progress",
                              "completed",
                              "skipped",
                              "cancelled"
                            ]
                          },
                          "assignment": {
                            "type": "string",
                            "enum": [
                              "person",
                              "role",
                              "external",
                              "open"
                            ]
                          },
                          "due_date": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "due_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "completed_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "status",
                          "assignment",
                          "due_date",
                          "due_at",
                          "completed_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "tasks"
                  ],
                  "additionalProperties": {}
                },
                "example": {
                  "id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                  "nummer": 1042,
                  "titel": "Order 4711",
                  "status": "active",
                  "prioritaet": "normal",
                  "vorlage": "Purchase order",
                  "verantwortlich": "Anna Berger",
                  "frist": "2026-11-30",
                  "fortschritt": {
                    "erledigt": 1,
                    "gesamt": 4
                  },
                  "felder": [
                    {
                      "id": "5d9e2c71-a8b4-4f36-9e01-7b3c6a2d8f15",
                      "label": "Order number",
                      "typ": "text",
                      "wert": "4711"
                    }
                  ],
                  "tasks": [
                    {
                      "id": "b9f2a6d4-3c8e-4170-9d5b-e1a4c7f8b032",
                      "name": "Record order",
                      "status": "completed",
                      "assignment": "role",
                      "due_date": null,
                      "due_at": null,
                      "completed_at": "2026-11-21T08:14:05.187220+00:00"
                    },
                    {
                      "id": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16",
                      "name": "Check invoice",
                      "status": "open",
                      "assignment": "role",
                      "due_date": "2026-11-27",
                      "due_at": null,
                      "completed_at": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{id}": {
      "get": {
        "operationId": "getTask",
        "tags": [
          "Tasks"
        ],
        "summary": "Get a task with its fields",
        "description": "One task with every output field the account may see — including empty ones — with field ID, type, required flag and option IDs.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "case_id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "name": {
                      "description": "Task name: for a task from the template, the step name in the template version the case runs on (renaming the step in the draft does not change it); for an ad-hoc task, its own name. null only if neither exists.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "waiting",
                        "open",
                        "in_progress",
                        "completed",
                        "skipped",
                        "cancelled"
                      ]
                    },
                    "due_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "due_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                            "description": "Field ID — use it to write values (PUT /tasks/{id}/values/{field_id})."
                          },
                          "label": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "task",
                              "case"
                            ],
                            "description": "`task`: output field of this task; `case`: case field edited here."
                          },
                          "required": {
                            "type": "boolean"
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                },
                                "label": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "label"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "filled": {
                            "type": "boolean"
                          },
                          "value": {
                            "description": "Current value; option ID for selections; null when empty."
                          }
                        },
                        "required": [
                          "id",
                          "label",
                          "type",
                          "scope",
                          "required",
                          "options",
                          "filled",
                          "value"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "case_id",
                    "name",
                    "status",
                    "due_date",
                    "due_at",
                    "completed_at",
                    "fields"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16",
                  "case_id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                  "name": "Check invoice",
                  "status": "open",
                  "due_date": "2026-11-27",
                  "due_at": null,
                  "completed_at": null,
                  "fields": [
                    {
                      "id": "e4a8c3f6-1d27-4b95-8c60-2f9b5e7a1d43",
                      "label": "Invoice amount",
                      "type": "number",
                      "scope": "task",
                      "required": true,
                      "options": [],
                      "filled": false,
                      "value": null
                    },
                    {
                      "id": "9b2f6d14-c5a3-4e87-b0d9-3a6e1c8f2b56",
                      "label": "Decision",
                      "type": "select",
                      "scope": "task",
                      "required": true,
                      "options": [
                        {
                          "id": "1c7a4e92-6b3d-4f50-a8e5-d2b9f0c6e371",
                          "label": "Approved"
                        },
                        {
                          "id": "f6d3b8a1-2e9c-4a74-b5f0-8c1e7d4a9b62",
                          "label": "Rejected"
                        }
                      ],
                      "filled": false,
                      "value": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/templates": {
      "get": {
        "operationId": "listTemplates",
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "Templates the API account may start cases from, with the fields asked on creation (IDs and option IDs) and whether a case can be created via the API (`creatable_via_api`, with `reason` if not). `workflows` lists the workflows to choose from when the template needs a choice (pass one as `workflow_id` to POST /cases); empty when the template starts its workflow on its own.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "create_fields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                                  "description": "Field ID — use it to write values (PUT /tasks/{id}/values/{field_id})."
                                },
                                "label": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string"
                                },
                                "required": {
                                  "type": "boolean"
                                },
                                "options": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "label",
                                "type",
                                "required",
                                "options"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "workflows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Workflows to choose from (name of the published version). Empty: no choice needed."
                          },
                          "creatable_via_api": {
                            "type": "boolean"
                          },
                          "reason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "not_published",
                                  "workflow_choice_required"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "create_fields",
                          "workflows",
                          "creatable_via_api",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "3f6c2a9e-0b1d-4c7e-9a52-6d8e1f4b2c70",
                      "name": "Purchase order",
                      "description": null,
                      "create_fields": [
                        {
                          "id": "5d9e2c71-a8b4-4f36-9e01-7b3c6a2d8f15",
                          "label": "Order number",
                          "type": "text",
                          "required": true,
                          "options": []
                        }
                      ],
                      "workflows": [
                        {
                          "id": "8a1e5d20-7c43-4f9b-b6e2-0d5a9c3f1e84",
                          "name": "Standard"
                        },
                        {
                          "id": "c2b7f915-3e6a-4d08-a1c4-9f2e6b8d0a37",
                          "name": "Rush order"
                        }
                      ],
                      "creatable_via_api": true,
                      "reason": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{id}/values/{field_id}": {
      "put": {
        "operationId": "saveTaskValue",
        "tags": [
          "Tasks"
        ],
        "summary": "Save a field value of a task",
        "description": "Saves one value in an output field of an open task, with the same rules as the form in the app: the field must be one of `fields` in GET /tasks/{id} (otherwise 404), the API account needs the right to edit task fields and must be allowed to work on the task (403 `not_assigned` otherwise), and a task waiting for approval is locked (409 `task_in_approval`). Last writer wins: a later save overwrites an earlier one, from the app or the API. Saving the same value again leaves the value as it is. Requires the header `Idempotency-Key` like every write, but the key is not remembered here: a retry writes the value again, and if someone changed the field in between, the retry overwrites that change (last writer wins); every change is an entry in the history. A saved value takes effect at once, as in the app: conditions and phases that depend on it are re-evaluated and webhooks fire. Answers the field as GET /tasks/{id} shows it. Fetched with GET /tasks: send `lock_token` and `run_no` (409 `task_locked` or `run_mismatch` otherwise).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16"
          },
          {
            "name": "field_id",
            "in": "path",
            "required": true,
            "description": "Field ID from `fields` of GET /tasks/{id}.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "e4a8c3f6-1d27-4b95-8c60-2f9b5e7a1d43"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your own unique key for this request (8–128 characters: letters, digits, . _ : -). Retry with the SAME key after a timeout or 409/503/504 — the API then returns the first result instead of acting twice. Valid 24 hours.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "example": "erp-invoice-4711-amount"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lock_token": {
                    "description": "`lock_token` from GET /tasks. With it, the write succeeds while your lock holds — and after it expired, as long as no one fetched the task again (then 409 `task_locked`). Without it, a task locked by another fetch answers 409 `task_locked`; a task never fetched behaves as before.",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "run_no": {
                    "description": "`run_no` from GET /tasks. Another run than the current one answers 409 `run_mismatch`.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "text": {
                    "description": "Text, long text, email, phone, URL. Multi-select: a JSON array of option IDs as text, e.g. `[\"<id>\",\"<id>\"]`. Person, contact and company fields: JSON as text, e.g. `{\"id\":\"<membership ID>\"}`.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "description": "Number, currency and rating fields.",
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "boolean": {
                    "description": "Yes/no fields.",
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "date": {
                    "description": "Date fields, YYYY-MM-DD.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10,
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "option_id": {
                    "description": "Selection fields: option ID from `options` of GET /tasks/{id}.",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false,
                "description": "Exactly ONE slot, matching the field type (`type` in GET /tasks/{id}). `null` empties the field. A slot that does not fit the field type answers 422 `invalid_value`."
              },
              "example": {
                "number": 1250.5,
                "lock_token": "0f5b2e8d-7a3c-4d91-b6f4-2c8e9a1d7b53",
                "run_no": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                      "description": "Field ID — use it to write values (PUT /tasks/{id}/values/{field_id})."
                    },
                    "label": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "task",
                        "case"
                      ],
                      "description": "`task`: output field of this task; `case`: case field edited here."
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "label": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "filled": {
                      "type": "boolean"
                    },
                    "value": {
                      "description": "Current value; option ID for selections; null when empty."
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "type",
                    "scope",
                    "required",
                    "options",
                    "filled",
                    "value"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "e4a8c3f6-1d27-4b95-8c60-2f9b5e7a1d43",
                  "label": "Invoice amount",
                  "type": "number",
                  "scope": "task",
                  "required": true,
                  "options": [],
                  "filled": true,
                  "value": 1250.5
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`conflict`, `idempotency_in_progress`, `task_blocked`, `task_not_open`, `case_not_active`, `task_in_approval`, `task_locked`, `run_mismatch`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "`payload_too_large`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`unprocessable`, `idempotency_key_reused`, `workflow_choice_required`, `workflow_not_selectable`, `member_inactive`, `required_fields_missing`, `invalid_value`, `completion_rejected`, `template_not_published`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "423": {
            "description": "`read_only`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "`outcome_unknown`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{id}/complete": {
      "post": {
        "operationId": "completeTask",
        "tags": [
          "Tasks"
        ],
        "summary": "Complete a task",
        "description": "Completes an open task with the same rules and side effects as in the app: the next tasks open, phases move on, condition values are published, assignees are notified and webhooks fire. The fetch lock comes first: a task another instance has locked answers 409 `task_locked` (a stale `run_no` 409 `run_mismatch`), even when it is blocked. Then checks in this order: blocked (409 `task_blocked`), responsible (403 `not_assigned` — a task of a person, or of a role the API account does not hold), approval pending (200 `approval_pending`, not submitted again while the approval is pending), required fields (422 `required_fields_missing` with field IDs and names). A task that needs an approval is submitted and answers `approval_pending` with the approver; approving is not part of the API. An already completed task answers 200 `completed` with who and when — so a retry after a timeout is safe. Skipped or cancelled tasks answer 409 `task_not_open`. The body is empty, `{}`, or carries `lock_token` and `run_no` from GET /tasks (409 `task_locked` or `run_mismatch` otherwise). Requires the header `Idempotency-Key` like every write.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Your own unique key for this request (8–128 characters: letters, digits, . _ : -). Retry with the SAME key after a timeout or 409/503/504 — the API then returns the first result instead of acting twice. Valid 24 hours.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{8,128}$"
            },
            "example": "erp-invoice-4711-done"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lock_token": {
                    "description": "`lock_token` from GET /tasks. With it, the write succeeds while your lock holds — and after it expired, as long as no one fetched the task again (then 409 `task_locked`). Without it, a task locked by another fetch answers 409 `task_locked`; a task never fetched behaves as before.",
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "run_no": {
                    "description": "`run_no` from GET /tasks. Another run than the current one answers 409 `run_mismatch`.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "lock_token": "0f5b2e8d-7a3c-4d91-b6f4-2c8e9a1d7b53",
                "run_no": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "case_id": {
                      "type": "string",
                      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "completed",
                        "approval_pending"
                      ],
                      "description": "`completed`, or `approval_pending` when the task needs an approval first (it was submitted once)."
                    },
                    "completed_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "completed_by": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Who completed the task — also when it was already completed before your call."
                    },
                    "approver": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "membership_id": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "role_id": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "membership_id",
                            "role_id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Approver (person or role) while `status` is `approval_pending`."
                    }
                  },
                  "required": [
                    "id",
                    "case_id",
                    "status",
                    "completed_at",
                    "completed_by",
                    "approver"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "4c1e8b73-d6a9-4f25-b3e8-0a7d2c9f5b16",
                  "case_id": "7e3a9c51-4b2d-4e86-9f17-a0c5d8b2e6f4",
                  "status": "completed",
                  "completed_at": "2026-11-23T10:04:31.662085+00:00",
                  "completed_by": {
                    "id": "a7e2c9f4-5b1d-4e38-9c6a-f8d0b3e5a142",
                    "name": "ERP integration"
                  },
                  "approver": null
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "`conflict`, `idempotency_in_progress`, `task_blocked`, `task_not_open`, `case_not_active`, `task_in_approval`, `task_locked`, `run_mismatch`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "`payload_too_large`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "`unprocessable`, `idempotency_key_reused`, `workflow_choice_required`, `workflow_not_selectable`, `member_inactive`, `required_fields_missing`, `invalid_value`, `completion_rejected`, `template_not_published`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "423": {
            "description": "`read_only`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "`outcome_unknown`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/members": {
      "get": {
        "operationId": "listMembers",
        "tags": [
          "Members"
        ],
        "summary": "List members",
        "description": "Active members of your organization with membership ID and display name — the IDs you need for `owner_id` in POST /cases. No email addresses in the answer. Not listed: pending invitations, deactivated or deleted members, customer portal users, and system accounts (API keys, agents, bots). External guests of your organization are listed. Names are not unique; `name` is null when the person has not set one. Oldest membership first; page through with `cursor` until `next_cursor` is null.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1–100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor from `next_cursor` of the previous page. Do not build or change it.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Find one member by login email (exact match, case-insensitive, no wildcards). Answers at most one member; an unknown address, a deactivated member and a member of another organization all answer the same empty list. The address is part of the URL and appears in request logs of the hosting platform.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 320
            },
            "example": "anna.berger@example.com"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
                            "description": "Membership ID — use it as `owner_id` in POST /cases."
                          },
                          "name": {
                            "description": "Display name; null when the person has not set one.",
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "6a4d9f2b-8c1e-4b73-a5d0-3e7f1c9b8a26",
                      "name": "Anna Berger"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/roles": {
      "get": {
        "operationId": "listRoles",
        "tags": [
          "Members"
        ],
        "summary": "List roles",
        "description": "Active roles of your organization with the membership IDs of their active holders. Holders may include system accounts such as an API key (a role handled by your integration) or an AI agent; those IDs do not appear in GET /members.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "member_ids": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                            },
                            "description": "Membership IDs of the active holders of this role."
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "member_ids"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "5e9b1d7c-2a6f-4c84-b3e0-9d4a8f1c6b27",
                      "name": "Purchasing",
                      "description": null,
                      "member_ids": [
                        "6a4d9f2b-8c1e-4b73-a5d0-3e7f1c9b8a26",
                        "d1c8a5e3-4f9b-4a62-8e7d-b0c3f6a2e195"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`invalid_parameter`, `unknown_parameter`, `invalid_limit`, `invalid_cursor`, `idempotency_key_required`, `invalid_body`, `unknown_command`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "`invalid_api_key`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "`account_has_admin_rights`, `forbidden`, `not_assigned`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "`not_found`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`, `too_many_concurrent_requests`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "`internal_error`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "`timeout`, `temporarily_unavailable`, `not_written`",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer <API key>"
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details.",
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "account_has_admin_rights",
              "case_not_active",
              "completion_rejected",
              "conflict",
              "forbidden",
              "idempotency_in_progress",
              "idempotency_key_required",
              "idempotency_key_reused",
              "internal_error",
              "invalid_api_key",
              "invalid_body",
              "invalid_cursor",
              "invalid_limit",
              "invalid_parameter",
              "invalid_value",
              "member_inactive",
              "not_assigned",
              "not_found",
              "not_written",
              "outcome_unknown",
              "payload_too_large",
              "rate_limited",
              "read_only",
              "required_fields_missing",
              "run_mismatch",
              "task_blocked",
              "task_in_approval",
              "task_locked",
              "task_not_open",
              "template_not_published",
              "temporarily_unavailable",
              "timeout",
              "too_many_concurrent_requests",
              "unknown_command",
              "unknown_parameter",
              "unprocessable",
              "workflow_choice_required",
              "workflow_not_selectable"
            ]
          },
          "fields": {
            "type": "array",
            "description": "`required_fields_missing`: the fields that block completion.",
            "items": {
              "type": "object",
              "required": [
                "id",
                "label",
                "reason"
              ],
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uuid",
                  "description": "Field ID for PUT /tasks/{id}/values/{field_id}."
                },
                "label": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "required",
                    "confirm"
                  ],
                  "description": "`confirm`: the field must be yes."
                }
              }
            }
          },
          "field_id": {
            "type": "string",
            "format": "uuid",
            "description": "`invalid_value`: the field whose value does not fit."
          },
          "task_status": {
            "type": "string",
            "description": "`task_not_open`: the current status of the task."
          },
          "run_no": {
            "type": "integer",
            "minimum": 1,
            "description": "`run_mismatch`: the current run of the task."
          },
          "workflows": {
            "type": "array",
            "description": "`workflow_choice_required`, `workflow_not_selectable`: the workflows to choose from (pass one as `workflow_id`).",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "reason": {
            "type": "string",
            "enum": [
              "no_external_approver",
              "no_approver",
              "escalation_open",
              "backjump_limit",
              "backjump_impossible",
              "rejected"
            ],
            "description": "`completion_rejected`: why the task cannot be completed."
          }
        }
      }
    }
  }
}