{
  "openapi": "3.1.0",
  "info": {
    "title": "Klientro Variables API",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://klientro.ru/api/public/v1",
      "description": "Public API"
    },
    {
      "url": "https://klientro.ru/api/v1",
      "description": "Compatibility address"
    }
  ],
  "paths": {
    "/projects/{project_id}/users/resolve": {
      "parameters": [
        {
          "name": "project_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "post": {
        "operationId": "publicVariables.resolve",
        "summary": "Найти ID клиента в проекте",
        "x-klientro-guide": {
          "scope": "variables:read",
          "detail": "Возвращает ID Клиентро по ID пользователя в мессенджере или проверяет ID из экспорта."
        },
        "security": [
          {
            "publicApiKey": []
          }
        ],
        "description": "Requires variables:read or, on the canonical public address only, users:resolve. Read-only lookup of an existing client. For messenger identity, the bot must belong to the project and the client must belong to that bot. The bot determines the messenger. With a profile ID, membership through any bot of the project is required. An unknown or inaccessible bot or client returns the same 404. Idempotency-Key is unsupported. Uses the same per-key and per-project quotas as other public variable requests.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "bot_id",
                      "messenger_user_id"
                    ],
                    "properties": {
                      "bot_id": {
                        "type": "string",
                        "pattern": "^(?:[1-9][0-9]{0,8}|1[0-9]{9}|20[0-9]{8}|21[0-3][0-9]{7}|214[0-6][0-9]{6}|2147[0-3][0-9]{5}|21474[0-7][0-9]{4}|214748[0-2][0-9]{3}|2147483[0-5][0-9]{2}|21474836[0-3][0-9]|214748364[0-7])$",
                        "not": {
                          "pattern": "[^0-9]"
                        },
                        "description": "Klientro bot ID from the Channels page, as a decimal string from 1 to 2147483647."
                      },
                      "messenger_user_id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{1,64}$"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "profile_id"
                    ],
                    "properties": {
                      "profile_id": {
                        "type": "string",
                        "pattern": "^[1-9][0-9]{0,18}$",
                        "description": "Positive signed-int64 ID as a decimal string."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Client ID used in variable paths and exports. No-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "profile_id"
                  ],
                  "properties": {
                    "profile_id": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]{0,18}$",
                      "description": "Positive signed-int64 ID as a decimal string."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid request or identifier. A field with the wrong identifier type, spelling or range returns invalid_identifier."
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid credentials. WWW-Authenticate Bearer."
          },
          "403": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Insufficient scope or dashboard permission."
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Project, bot, client or project-owned WORKSPACE.USER variable inaccessible."
          },
          "405": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Method not allowed; Allow lists supported methods. HEAD uses GET semantics and requires read scope."
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "resource_busy or native_scope_busy (Retry-After 1), resource_changed, native_scope_owned, value_unset, invalid_stored_value, request_conflict or idempotency_conflict."
          },
          "410": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "operation_erased; permanent tombstone prevents execution."
          },
          "413": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "request_too_large; actual body exceeds 65536 bytes."
          },
          "415": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "json_required or unsupported_encoding."
          },
          "421": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "unknown_service_origin; check the configured HTTPS service origin."
          },
          "422": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "A body with the wrong object shape or duplicate members returns invalid_body. A JSON member containing NUL returns invalid_value."
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "rate_limited; Retry-After in seconds."
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "public_api_disabled or public_api_unavailable."
          }
        }
      }
    },
    "/projects/{project_id}/users/{profile}/variables": {
      "parameters": [
        {
          "name": "project_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        {
          "name": "profile",
          "in": "path",
          "required": true,
          "description": "Customer export ID (platform profile), never messenger ID or bot-profile link ID.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        }
      ],
      "get": {
        "operationId": "publicVariables.readMany",
        "summary": "Получить несколько переменных клиента",
        "x-klientro-guide": {
          "scope": "variables:read",
          "detail": "Возвращает до 20 выбранных переменных одного клиента за один запрос."
        },
        "security": [
          {
            "publicApiKey": []
          }
        ],
        "description": "Requires variables:read. Select 1–20 distinct, exact project-owned WORKSPACE.USER names. All names and customer membership must pass the single-read access and native ownership rules. Values come from one read snapshot in request order, with null for unset. An inaccessible name fails the whole request. Total stored value bytes are capped at 64 KiB. Counts as one request against each existing quota. Idempotency-Key is unsupported.",
        "parameters": [
          {
            "name": "names[]",
            "in": "query",
            "required": true,
            "style": "form",
            "explode": true,
            "description": "Repeat names[] once per exact name. Use URL encoding. Indexed keys, duplicate names and other query parameters are refused.",
            "schema": {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[^/\\\\\\x00-\\x1f\\x7f-\\x9f]+$"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Selected values in input order. No-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "variables"
                  ],
                  "properties": {
                    "variables": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "variable",
                          "type",
                          "value"
                        ],
                        "properties": {
                          "variable": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128,
                            "pattern": "^[^/\\\\\\x00-\\x1f\\x7f-\\x9f]+$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "integer",
                              "number",
                              "boolean",
                              "date",
                              "datetime",
                              "file",
                              "json",
                              "time",
                              "enum"
                            ]
                          },
                          "value": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid JSON, identifier, variable name or name list, header or insecure request."
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid credentials. WWW-Authenticate Bearer."
          },
          "403": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Insufficient scope or dashboard permission."
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Project, bot, client or project-owned WORKSPACE.USER variable inaccessible."
          },
          "405": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Method not allowed; Allow lists supported methods. HEAD uses GET semantics and requires read scope."
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "resource_busy or native_scope_busy (Retry-After 1), resource_changed, native_scope_owned, value_unset, invalid_stored_value, request_conflict or idempotency_conflict."
          },
          "410": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "operation_erased; permanent tombstone prevents execution."
          },
          "413": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "request_too_large; actual body exceeds 65536 bytes."
          },
          "414": {
            "description": "The request URL exceeded the gateway limit. Split the selection into smaller requests."
          },
          "415": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "json_required or unsupported_encoding."
          },
          "421": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "unknown_service_origin; check the configured HTTPS service origin."
          },
          "422": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid value, number_out_of_range, invalid_integer, unsupported_variable_type, not_numeric or value_too_large. No submitted or stored value is echoed."
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "rate_limited; Retry-After in seconds."
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "public_api_disabled, public_api_unavailable or native_scope_unavailable; no assumption about a lost COMMIT acknowledgement."
          }
        }
      }
    },
    "/projects/{project_id}/users/{profile}/variables/{variable}": {
      "parameters": [
        {
          "name": "project_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        {
          "name": "profile",
          "in": "path",
          "required": true,
          "description": "Customer export ID (platform profile), never messenger ID or bot-profile link ID.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        {
          "name": "variable",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[^/\\\\\\x00-\\x1f\\x7f-\\x9f]+$"
          }
        }
      ],
      "get": {
        "operationId": "publicVariables.read",
        "summary": "Получить значение переменной клиента",
        "x-klientro-guide": {
          "scope": "variables:read",
          "detail": "Возвращает значение одной переменной, например текущий баланс."
        },
        "security": [
          {
            "publicApiKey": []
          }
        ],
        "description": "Requires variables:read independently of write. Exact project-owned WORKSPACE.USER definition and current project membership. Values are existing stored text, not HTML-escaped; unset is null. Maximum stored value 64 KiB. Native-owned fields refuse; no stale-copy fallback. 120/min per key and 600/min per credential project by joint Redis fixed-window admission, configurable centrally. Scope refusals, foreign-project attempts, resource failures and receipt replays spend the credential's quotas; a foreign target project's quota is never charged. Idempotency-Key is unsupported on reads. No CORS admission.",
        "responses": {
          "200": {
            "description": "Stored value; no-store.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "variable",
                    "type",
                    "value"
                  ],
                  "properties": {
                    "variable": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^[^/\\\\\\x00-\\x1f\\x7f-\\x9f]+$"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "integer",
                        "number",
                        "boolean",
                        "date",
                        "datetime",
                        "file",
                        "json",
                        "time",
                        "enum"
                      ]
                    },
                    "value": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid JSON, identifier, variable name or name list, header or insecure request."
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid credentials. WWW-Authenticate Bearer."
          },
          "403": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Insufficient scope or dashboard permission."
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Project, bot, client or project-owned WORKSPACE.USER variable inaccessible."
          },
          "405": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Method not allowed; Allow lists supported methods. HEAD uses GET semantics and requires read scope."
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "resource_busy or native_scope_busy (Retry-After 1), resource_changed, native_scope_owned, value_unset, invalid_stored_value, request_conflict or idempotency_conflict."
          },
          "410": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "operation_erased; permanent tombstone prevents execution."
          },
          "413": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "request_too_large; actual body exceeds 65536 bytes."
          },
          "415": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "json_required or unsupported_encoding."
          },
          "421": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "unknown_service_origin; check the configured HTTPS service origin."
          },
          "422": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid value, number_out_of_range, invalid_integer, unsupported_variable_type, not_numeric or value_too_large. No submitted or stored value is echoed."
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "rate_limited; Retry-After in seconds."
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "public_api_disabled, public_api_unavailable or native_scope_unavailable; no assumption about a lost COMMIT acknowledgement."
          }
        }
      },
      "put": {
        "operationId": "publicVariables.set",
        "summary": "Заменить значение переменной клиента",
        "x-klientro-guide": {
          "scope": "variables:write",
          "detail": "Записывает новое значение целиком, например устанавливает баланс 1500."
        },
        "security": [
          {
            "publicApiKey": []
          }
        ],
        "description": "Requires variables:write. Absolute replacement, never compare-and-swap; Idempotency-Key is rejected. Strings preserve whitespace; booleans are JSON booleans; integers accept integral JSON numbers or decimal integer strings within int64; numbers accept exact decimal strings or JSON numbers. Date d.m.Y, datetime Y-m-d H:i:s in existing customer wall-clock interpretation. File/json/time/enum PUT is unsupported. Numeric input <=128 characters, exponent magnitude <=128, normalized unscaled integer <=38 digits, scale <=14, integer int64; no rounding. No existing value, changed flag or numeric bounds derived from it is returned.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "type": [
                      "string",
                      "number",
                      "boolean"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed operation; never returns an existing or resulting value. Replay returns identical operation_id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "operation_id"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "operation_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid JSON, identifier, variable name or name list, header or insecure request."
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid credentials. WWW-Authenticate Bearer."
          },
          "403": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Insufficient scope or dashboard permission."
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Project, bot, client or project-owned WORKSPACE.USER variable inaccessible."
          },
          "405": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Method not allowed; Allow lists supported methods. HEAD uses GET semantics and requires read scope."
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "resource_busy or native_scope_busy (Retry-After 1), resource_changed, native_scope_owned, value_unset, invalid_stored_value, request_conflict or idempotency_conflict."
          },
          "410": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "operation_erased; permanent tombstone prevents execution."
          },
          "413": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "request_too_large; actual body exceeds 65536 bytes."
          },
          "415": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "json_required or unsupported_encoding."
          },
          "421": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "unknown_service_origin; check the configured HTTPS service origin."
          },
          "422": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid value, number_out_of_range, invalid_integer, unsupported_variable_type, not_numeric or value_too_large. No submitted or stored value is echoed."
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "rate_limited; Retry-After in seconds."
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "public_api_disabled, public_api_unavailable or native_scope_unavailable; no assumption about a lost COMMIT acknowledgement."
          }
        }
      }
    },
    "/projects/{project_id}/users/{profile}/variables/{variable}/adjust": {
      "parameters": [
        {
          "name": "project_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        {
          "name": "profile",
          "in": "path",
          "required": true,
          "description": "Customer export ID (platform profile), never messenger ID or bot-profile link ID.",
          "schema": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          }
        },
        {
          "name": "variable",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[^/\\\\\\x00-\\x1f\\x7f-\\x9f]+$"
          }
        },
        {
          "name": "Idempotency-Key",
          "in": "header",
          "required": false,
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[A-Za-z0-9._:-]+$"
          }
        }
      ],
      "post": {
        "operationId": "publicVariables.adjust",
        "x-klientro-guide": {
          "scope": "variables:write",
          "detail": "Прибавляет или вычитает число, например списывает 100 с баланса."
        },
        "summary": "Увеличить или уменьшить значение переменной клиента",
        "security": [
          {
            "publicApiKey": []
          }
        ],
        "description": "Requires variables:write. Existing integer/number value only; unset returns 409. Exact atomic SQL arithmetic. Optional case-sensitive Idempotency-Key is unique project-wide and never expires during project lifetime, including after key rotation. Equivalent numeric deltas replay the original acknowledgement before mutable-resource resolution; changed input returns 409. Failed transactions reserve nothing. No header means every accepted call applies independently. Legacy read/calculate/SET formulas can overwrite adjustments and must not be competing balance writers.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "delta"
                ],
                "properties": {
                  "delta": {
                    "type": [
                      "string",
                      "number"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Committed operation; never returns an existing or resulting value. Replay returns identical operation_id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "operation_id"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "operation_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid JSON, identifier, variable name or name list, header or insecure request."
          },
          "401": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid credentials. WWW-Authenticate Bearer."
          },
          "403": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Insufficient scope or dashboard permission."
          },
          "404": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Project, bot, client or project-owned WORKSPACE.USER variable inaccessible."
          },
          "405": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Method not allowed; Allow lists supported methods. HEAD uses GET semantics and requires read scope."
          },
          "409": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "resource_busy or native_scope_busy (Retry-After 1), resource_changed, native_scope_owned, value_unset, invalid_stored_value, request_conflict or idempotency_conflict."
          },
          "410": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "operation_erased; permanent tombstone prevents execution."
          },
          "413": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "request_too_large; actual body exceeds 65536 bytes."
          },
          "415": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "json_required or unsupported_encoding."
          },
          "421": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "unknown_service_origin; check the configured HTTPS service origin."
          },
          "422": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "Invalid value, number_out_of_range, invalid_integer, unsupported_variable_type, not_numeric or value_too_large. No submitted or stored value is echoed."
          },
          "429": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "rate_limited; Retry-After in seconds."
          },
          "503": {
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string",
                      "pattern": "^[a-z_]{1,64}$"
                    }
                  }
                }
              }
            },
            "description": "public_api_disabled, public_api_unavailable or native_scope_unavailable; no assumption about a lost COMMIT acknowledgement."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "publicApiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Opaque kl_ project key; never accepted by dashboard authentication"
      }
    }
  }
}
