{
  "components": {
    "headers": {
      "Deprecation": {
        "description": "Per RFC 9745: point in time (structured date `@<Unix seconds>`) from which the endpoint is deprecated. Only sent once a version is being retired.",
        "schema": {
          "examples": [
            "@1798761600"
          ],
          "type": "string"
        }
      },
      "RateLimit": {
        "description": "Remaining requests (r) and seconds until reset (t).",
        "schema": {
          "examples": [
            "\"default\";r=57;t=42"
          ],
          "type": "string"
        }
      },
      "RateLimit-Policy": {
        "description": "Limit per token: 60 requests (q) per 60 seconds (w).",
        "schema": {
          "examples": [
            "\"default\";q=60;w=60"
          ],
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Seconds until the next request is allowed.",
        "schema": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "Sunset": {
        "description": "Per RFC 8594: HTTP date after which the endpoint will be shut down. Only sent once a version is being retired.",
        "schema": {
          "examples": [
            "Fri, 01 Jan 2027 00:00:00 GMT"
          ],
          "type": "string"
        }
      },
      "WWW-Authenticate": {
        "description": "Bearer challenge per RFC 6750 with the error and the required scope.",
        "schema": {
          "examples": [
            "Bearer error=\"insufficient_scope\", scope=\"integrations:write\", resource_metadata=\"https://api.kiosa.ai/.well-known/oauth-protected-resource/v1\""
          ],
          "type": "string"
        }
      },
      "X-Request-Id": {
        "description": "ID of this request, for support: `req_` followed by a 26-character ULID.",
        "schema": {
          "examples": [
            "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A"
          ],
          "pattern": "^req_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
          "type": "string"
        }
      }
    },
    "schemas": {
      "Address": {
        "description": "Postal address; unknown parts are null.",
        "properties": {
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "City."
          },
          "country": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Country as ISO 3166-1 alpha-2 code."
          },
          "postal_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Postal code."
          },
          "street": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Street and house number."
          }
        },
        "required": [
          "street",
          "postal_code",
          "city",
          "country"
        ],
        "type": "object"
      },
      "BranchList": {
        "description": "All branches at the provider.",
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/ProviderBranch"
            },
            "type": "array"
          }
        },
        "required": [
          "data"
        ],
        "type": "object"
      },
      "BranchMapping": {
        "anyOf": [
          {
            "additionalProperties": false,
            "properties": {
              "branch_id": {
                "description": "Branch ID at the provider.",
                "minLength": 1,
                "type": "string"
              },
              "location_id": {
                "description": "Kiosa location of this business.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "branch_id",
              "location_id"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "branch_id": {
                "description": "Branch ID at the provider.",
                "minLength": 1,
                "type": "string"
              },
              "ignore": {
                "const": true,
                "description": "Do not import this branch.",
                "type": "boolean"
              }
            },
            "required": [
              "branch_id",
              "ignore"
            ],
            "type": "object"
          }
        ],
        "description": "Map a branch to a Kiosa location, or ignore the whole branch."
      },
      "BranchMappingRequest": {
        "additionalProperties": false,
        "description": "Changes to the branch mapping.",
        "properties": {
          "mappings": {
            "description": "Branches to change. Branches not listed keep their mapping.",
            "items": {
              "$ref": "#/components/schemas/BranchMapping"
            },
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "mappings"
        ],
        "type": "object"
      },
      "ImportState": {
        "description": "An import run.",
        "properties": {
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "End of the run."
          },
          "started_at": {
            "description": "Start of the run.",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "description": "State of the import run.",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "started_at",
          "finished_at"
        ],
        "type": "object"
      },
      "Integration": {
        "description": "Full status of one integration.",
        "properties": {
          "api_key_last4": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Last four characters of the stored key. Kiosa never returns the key itself."
          },
          "company_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Company ID at the provider."
          },
          "connected_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the current credentials were stored."
          },
          "initial_import": {
            "anyOf": [
              {
                "properties": {
                  "since": {
                    "description": "First day imported: 1 January of the previous year.",
                    "format": "date",
                    "type": "string"
                  },
                  "status": {
                    "description": "State of the initial import.",
                    "enum": [
                      "waiting_for_mapping",
                      "running",
                      "succeeded",
                      "failed"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "since"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Initial import of the history. It starts automatically once all branches are mapped."
          },
          "issues": {
            "description": "Open issues; empty when everything is fine.",
            "items": {
              "$ref": "#/components/schemas/IntegrationIssue"
            },
            "type": "array"
          },
          "key_expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expiry of the key, if known."
          },
          "last_import": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ImportState"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider": {
            "description": "Integration provider. v1 supports `ordio` only.",
            "enum": [
              "ordio"
            ],
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/IntegrationStatus"
          }
        },
        "required": [
          "provider",
          "status",
          "company_id",
          "api_key_last4",
          "key_expires_at",
          "connected_at",
          "initial_import",
          "last_import",
          "issues"
        ],
        "type": "object"
      },
      "IntegrationIssue": {
        "description": "Something the business or the partner has to resolve.",
        "properties": {
          "code": {
            "description": "Stable issue code. `other_staff_provider_active`: another staff system is already active for this business in Kiosa; the business contacts Kiosa to switch to ordio (the API never switches it off).",
            "enum": [
              "unmapped_branches",
              "key_expires_soon",
              "key_expired",
              "provider_auth_failed",
              "missing_provider_scopes",
              "import_failed",
              "other_staff_provider_active"
            ],
            "type": "string"
          },
          "detail": {
            "description": "Human-readable explanation in English.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "detail"
        ],
        "type": "object"
      },
      "IntegrationList": {
        "description": "All integrations of the business.",
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/IntegrationSummary"
            },
            "type": "array"
          }
        },
        "required": [
          "data"
        ],
        "type": "object"
      },
      "IntegrationStatus": {
        "description": "`not_connected`: no credentials stored. `testing`: Kiosa is still verifying the credentials. `needs_mapping`: connected, but at least one branch is not mapped yet. `active`: connected and fully mapped, imports run. `error`: the last test or import failed, see `issues`.",
        "enum": [
          "not_connected",
          "testing",
          "needs_mapping",
          "active",
          "error"
        ],
        "type": "string"
      },
      "IntegrationSummary": {
        "description": "Short status of one integration.",
        "properties": {
          "last_import_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "End of the last successful import."
          },
          "provider": {
            "description": "Integration provider. v1 supports `ordio` only.",
            "enum": [
              "ordio"
            ],
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/IntegrationStatus"
          },
          "writable": {
            "description": "`true` when this client may manage the integration through the API.",
            "type": "boolean"
          }
        },
        "required": [
          "provider",
          "status",
          "writable",
          "last_import_at"
        ],
        "type": "object"
      },
      "IntegrationWithBranches": {
        "description": "Integration status including the branch mapping.",
        "properties": {
          "api_key_last4": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Last four characters of the stored key. Kiosa never returns the key itself."
          },
          "branches": {
            "description": "Branches at the provider with their mapping; empty while the status is `testing`.",
            "items": {
              "$ref": "#/components/schemas/ProviderBranch"
            },
            "type": "array"
          },
          "company_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Company ID at the provider."
          },
          "connected_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the current credentials were stored."
          },
          "initial_import": {
            "anyOf": [
              {
                "properties": {
                  "since": {
                    "description": "First day imported: 1 January of the previous year.",
                    "format": "date",
                    "type": "string"
                  },
                  "status": {
                    "description": "State of the initial import.",
                    "enum": [
                      "waiting_for_mapping",
                      "running",
                      "succeeded",
                      "failed"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "since"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Initial import of the history. It starts automatically once all branches are mapped."
          },
          "issues": {
            "description": "Open issues; empty when everything is fine.",
            "items": {
              "$ref": "#/components/schemas/IntegrationIssue"
            },
            "type": "array"
          },
          "key_expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expiry of the key, if known."
          },
          "last_import": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ImportState"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider": {
            "description": "Integration provider. v1 supports `ordio` only.",
            "enum": [
              "ordio"
            ],
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/IntegrationStatus"
          }
        },
        "required": [
          "provider",
          "status",
          "company_id",
          "api_key_last4",
          "key_expires_at",
          "connected_at",
          "initial_import",
          "last_import",
          "issues",
          "branches"
        ],
        "type": "object"
      },
      "Location": {
        "description": "A location (restaurant) of the business.",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "id": {
            "description": "Kiosa location ID. Use it as `location_id` in branch mappings.",
            "type": "string"
          },
          "name": {
            "description": "Name of the location.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "address"
        ],
        "type": "object"
      },
      "LocationList": {
        "description": "All locations of the business.",
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/Location"
            },
            "type": "array"
          }
        },
        "required": [
          "data"
        ],
        "type": "object"
      },
      "Me": {
        "description": "The connection behind the access token.",
        "properties": {
          "account": {
            "description": "The business that granted access.",
            "properties": {
              "id": {
                "description": "Kiosa ID of the business.",
                "type": "string"
              },
              "name": {
                "description": "Name of the business.",
                "type": "string"
              },
              "slug": {
                "description": "Kiosa address of the business (`<slug>.kiosa.ai`).",
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "slug"
            ],
            "type": "object"
          },
          "consented_at": {
            "description": "When an admin of the business granted access to this client (ISO 8601 with offset).",
            "format": "date-time",
            "type": "string"
          },
          "scopes": {
            "description": "Scopes granted to this token.",
            "items": {
              "$ref": "#/components/schemas/Scope"
            },
            "type": "array"
          }
        },
        "required": [
          "account",
          "consented_at",
          "scopes"
        ],
        "type": "object"
      },
      "OrdioCredentials": {
        "additionalProperties": false,
        "description": "Credentials of the ordio integration.",
        "properties": {
          "api_key": {
            "description": "ordio API key with the scopes branches:read, shifts:read, absences:read and wages:read.",
            "minLength": 1,
            "type": "string"
          },
          "company_id": {
            "description": "ordio company ID.",
            "minLength": 1,
            "type": "string"
          },
          "key_expires_at": {
            "description": "Expiry of the key. Kiosa reminds the business before it expires.",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "company_id"
        ],
        "type": "object"
      },
      "Problem": {
        "description": "RFC 9457 problem details. `title` and `detail` are always in English; localized texts per `code` are in the docs.",
        "properties": {
          "code": {
            "description": "Stable machine-readable error code. Branch on this, not on `title` or `detail`.",
            "enum": [
              "invalid_token",
              "insufficient_scope",
              "user_inactive",
              "partner_not_approved",
              "partner_suspended",
              "partner_apps_disabled",
              "admin_required",
              "not_found",
              "validation_failed",
              "rate_limited",
              "provider_auth_failed",
              "missing_provider_scopes",
              "provider_unreachable",
              "provider_not_allowed",
              "mapping_conflict",
              "internal_error",
              "payload_too_large",
              "upstream_unavailable",
              "upstream_timeout",
              "service_unavailable"
            ],
            "type": "string"
          },
          "detail": {
            "description": "Explanation of this occurrence.",
            "type": "string"
          },
          "invalid_params": {
            "description": "Only for `validation_failed`.",
            "items": {
              "properties": {
                "name": {
                  "description": "Field path, for example `mappings[0].location_id`.",
                  "type": "string"
                },
                "reason": {
                  "description": "What is wrong with the field.",
                  "type": "string"
                }
              },
              "required": [
                "name",
                "reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "missing_scopes": {
            "description": "Only for `missing_provider_scopes`: scopes the provider key lacks.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "request_id": {
            "description": "Same value as the X-Request-Id header: `req_` followed by a 26-character ULID.",
            "pattern": "^req_[0-7][0-9A-HJKMNP-TV-Z]{25}$",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code.",
            "type": "integer"
          },
          "title": {
            "description": "Short summary of the error code.",
            "type": "string"
          },
          "type": {
            "description": "Documentation URL of the error code: `https://docs.kiosa.ai/en/reference/errors/#<code>`, identical in every language.",
            "format": "uri",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "code",
          "request_id"
        ],
        "type": "object"
      },
      "ProviderBranch": {
        "description": "A branch at the provider and its Kiosa location.",
        "properties": {
          "branch_id": {
            "description": "Branch ID at the provider.",
            "type": "string"
          },
          "location_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Kiosa location the branch is mapped to."
          },
          "mapping": {
            "description": "`mapped`: imported into `location_id`. `ignored`: not imported. `unmapped`: still open.",
            "enum": [
              "mapped",
              "ignored",
              "unmapped"
            ],
            "type": "string"
          },
          "name": {
            "description": "Branch name at the provider.",
            "type": "string"
          },
          "suggested_location_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Suggestion for an unmapped branch, based on a matching name."
          }
        },
        "required": [
          "branch_id",
          "name",
          "mapping",
          "location_id",
          "suggested_location_id"
        ],
        "type": "object"
      },
      "Scope": {
        "description": "OAuth scope.",
        "enum": [
          "account:read",
          "integrations:read",
          "integrations:write"
        ],
        "type": "string"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.kiosa.ai/api/oauth/authorize",
            "refreshUrl": "https://api.kiosa.ai/api/oauth/token",
            "scopes": {
              "account:read": "Read the business, its locations and the current connection.",
              "integrations:read": "Read the status of the business integrations.",
              "integrations:write": "Hand over provider credentials, map branches and disconnect integrations. Includes integrations:read."
            },
            "tokenUrl": "https://api.kiosa.ai/api/oauth/token"
          }
        },
        "type": "oauth2"
      }
    }
  },
  "info": {
    "contact": {
      "name": "Kiosa",
      "url": "https://docs.kiosa.ai"
    },
    "description": "The Kiosa API connects your software to the Kiosa account of a hospitality business. Version 1 covers setting up integrations: read the business and its locations, submit credentials, map branches, disconnect.\n\n**Partner preview:** every endpoint is published as a contract and may still change before general availability.\n\n## Authorization\nOAuth 2.0 authorization code flow with PKCE (S256). Your client ID is an https URL on your domain serving a client metadata document (CIMD); it is a public client without a secret. During authorization the user enters their Kiosa address; pass `login_hint=<slug>` to prefill it. Only admins of the business can consent. Access tokens are valid for 1 hour, refresh tokens rotate on every use. Tokens are issued for `resource=https://api.kiosa.ai/v1` and are valid for this API only. Revocation: `https://api.kiosa.ai/api/oauth/revoke`.\n\nThe API is only open to approved, active partners: a client that is not listed gets no scope at all, not even a read scope (authorization ends with `unauthorized_client`). `integrations:write` only covers the providers in the approval. The business can turn off partner apps in Kiosa at any time.\n\n## Errors\nErrors use `application/problem+json` (RFC 9457) with `type`, `title`, `status`, `detail`, `code` and `request_id`. `type` is `https://docs.kiosa.ai/en/reference/errors/#<code>`. Branch on `code`; the docs list every code.\n\n## Rate limits\nEach token may send 60 requests per minute. Every response carries `RateLimit-Policy: \"default\";q=60;w=60` and `RateLimit: \"default\";r=<remaining>;t=<seconds until reset>`. Exceeding the limit returns `429` with `Retry-After` in seconds.\n\n## Versioning\nThe major version is part of the path. New fields, endpoints and error codes are added without a version change; ignore unknown fields. Breaking changes only ship in a new major version; the previous one keeps running for at least 12 months and is announced with the `Deprecation` and `Sunset` headers.\n\n## Request ID\nEvery response carries `X-Request-Id` in the format `req_` + 26-character ULID (for example `req_01JDX5Q8M3V8F2K7ZB9T4N6C1A`); errors repeat it as `request_id`. Quote it when contacting Kiosa.",
    "title": "Kiosa API",
    "version": "1.0.0"
  },
  "jsonSchemaDialect": "https://spec.openapis.org/oas/3.1/dialect/base",
  "openapi": "3.1.0",
  "paths": {
    "/integrations": {
      "get": {
        "description": "Returns every provider that can be managed through the API (v1: `ordio`) with a short status, including unconnected ones (`not_connected`). `writable` shows whether this client may manage the provider. More providers are added without a version change.",
        "operationId": "listIntegrations",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "last_import_at": null,
                      "provider": "ordio",
                      "status": "needs_mapping",
                      "writable": true
                    }
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/IntegrationList"
                }
              }
            },
            "description": "All integrations of the business that can be managed through the API.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:read"
            ]
          }
        ],
        "summary": "List integrations",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    },
    "/integrations/{provider}": {
      "delete": {
        "description": "Deletes the credentials and stops running and future imports before responding. Data already imported stays in Kiosa. When you reconnect later, gaps longer than 7 days are not backfilled; the nightly sync only loads the last 7 days. If nothing is connected, the call also returns 204. This does not end the OAuth access of your client; use token revocation for that.",
        "operationId": "deleteIntegration",
        "parameters": [
          {
            "description": "Integration provider. v1 supports `ordio` only.",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "ordio"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Integration disconnected.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "admin_required": {
                    "summary": "Admin required",
                    "value": {
                      "code": "admin_required",
                      "detail": "Write calls require the user who granted access to still be an admin of the business. An admin has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Admin required",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#admin_required"
                    }
                  },
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "provider_not_allowed": {
                    "summary": "Provider not allowed",
                    "value": {
                      "code": "provider_not_allowed",
                      "detail": "This client may not write integrations of this provider. Each partner is approved only for the providers agreed with Kiosa.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Provider not allowed",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_not_allowed"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`, `admin_required`, `provider_not_allowed`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "not_found": {
                    "summary": "Not found",
                    "value": {
                      "code": "not_found",
                      "detail": "The resource does not exist or the provider is not supported by the API.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 404,
                      "title": "Not found",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `not_found`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:write"
            ]
          }
        ],
        "summary": "Disconnect an integration",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      },
      "get": {
        "description": "Returns the full status of an integration: connection, initial import, last import and open issues. If nothing is connected, the status is `not_connected` (no 404). After a PUT answered with 202, poll this endpoint until the status is no longer `testing`.",
        "operationId": "getIntegration",
        "parameters": [
          {
            "description": "Integration provider. v1 supports `ordio` only.",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "ordio"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "api_key_last4": "x9Qa",
                  "company_id": "1234",
                  "connected_at": "2026-11-24T10:15:02+01:00",
                  "initial_import": {
                    "since": "2025-01-01",
                    "status": "waiting_for_mapping"
                  },
                  "issues": [
                    {
                      "code": "unmapped_branches",
                      "detail": "1 ordio branch is not mapped to a Kiosa location yet."
                    }
                  ],
                  "key_expires_at": "2027-11-30T23:59:59+01:00",
                  "last_import": null,
                  "provider": "ordio",
                  "status": "needs_mapping"
                },
                "schema": {
                  "$ref": "#/components/schemas/Integration"
                }
              }
            },
            "description": "Status of the integration.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "not_found": {
                    "summary": "Not found",
                    "value": {
                      "code": "not_found",
                      "detail": "The resource does not exist or the provider is not supported by the API.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 404,
                      "title": "Not found",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `not_found`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:read"
            ]
          }
        ],
        "summary": "Get an integration",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      },
      "put": {
        "description": "Submits the provider credentials. Kiosa verifies them with the provider right away (key valid, all required permissions present), stores them encrypted and maps branches with an unambiguously matching name to Kiosa locations. Once every branch is mapped, the initial import starts from 1 January of the previous year. The call is idempotent: the same body changes nothing and starts no second import; a new key replaces the old one. A new `company_id` discards all existing mappings. The business sees in Kiosa that the integration was connected.",
        "operationId": "putIntegration",
        "parameters": [
          {
            "description": "Integration provider. v1 supports `ordio` only.",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "ordio"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "api_key": "<your-ordio-api-key>",
                "company_id": "1234",
                "key_expires_at": "2027-11-30T23:59:59+01:00"
              },
              "schema": {
                "$ref": "#/components/schemas/OrdioCredentials"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "api_key_last4": "x9Qa",
                  "branches": [
                    {
                      "branch_id": "4711",
                      "location_id": "cm3loc0000city0000000001",
                      "mapping": "mapped",
                      "name": "Trattoria City",
                      "suggested_location_id": null
                    },
                    {
                      "branch_id": "4712",
                      "location_id": null,
                      "mapping": "unmapped",
                      "name": "Trattoria am Hafen GmbH",
                      "suggested_location_id": "cm3loc0000hafen000000002"
                    },
                    {
                      "branch_id": "4713",
                      "location_id": null,
                      "mapping": "ignored",
                      "name": "Zentrale Verwaltung",
                      "suggested_location_id": null
                    }
                  ],
                  "company_id": "1234",
                  "connected_at": "2026-11-24T10:15:02+01:00",
                  "initial_import": {
                    "since": "2025-01-01",
                    "status": "waiting_for_mapping"
                  },
                  "issues": [
                    {
                      "code": "unmapped_branches",
                      "detail": "1 ordio branch is not mapped to a Kiosa location yet."
                    }
                  ],
                  "key_expires_at": "2027-11-30T23:59:59+01:00",
                  "last_import": null,
                  "provider": "ordio",
                  "status": "needs_mapping"
                },
                "schema": {
                  "$ref": "#/components/schemas/IntegrationWithBranches"
                }
              }
            },
            "description": "Credentials verified and stored, including the mapping suggestion.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "202": {
            "content": {
              "application/json": {
                "example": {
                  "api_key_last4": "x9Qa",
                  "branches": [],
                  "company_id": "1234",
                  "connected_at": "2026-11-24T10:15:02+01:00",
                  "initial_import": null,
                  "issues": [],
                  "key_expires_at": "2027-11-30T23:59:59+01:00",
                  "last_import": null,
                  "provider": "ordio",
                  "status": "testing"
                },
                "schema": {
                  "$ref": "#/components/schemas/IntegrationWithBranches"
                }
              }
            },
            "description": "Verification takes longer than 10 seconds. Status `testing`; `GET /integrations/{provider}` returns the result.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "admin_required": {
                    "summary": "Admin required",
                    "value": {
                      "code": "admin_required",
                      "detail": "Write calls require the user who granted access to still be an admin of the business. An admin has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Admin required",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#admin_required"
                    }
                  },
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "provider_not_allowed": {
                    "summary": "Provider not allowed",
                    "value": {
                      "code": "provider_not_allowed",
                      "detail": "This client may not write integrations of this provider. Each partner is approved only for the providers agreed with Kiosa.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Provider not allowed",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_not_allowed"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`, `admin_required`, `provider_not_allowed`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "not_found": {
                    "summary": "Not found",
                    "value": {
                      "code": "not_found",
                      "detail": "The resource does not exist or the provider is not supported by the API.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 404,
                      "title": "Not found",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `not_found`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "Payload too large",
                    "value": {
                      "code": "payload_too_large",
                      "detail": "The request body exceeds 64 KB. Kiosa did not process the request.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 413,
                      "title": "Payload too large",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#payload_too_large"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `payload_too_large`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "missing_provider_scopes": {
                    "summary": "Missing provider scopes",
                    "value": {
                      "code": "missing_provider_scopes",
                      "detail": "The key works but lacks permissions Kiosa needs for the import; missing_scopes lists them. Issue a key with all permissions and submit it again.",
                      "missing_scopes": [
                        "wages:read"
                      ],
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 422,
                      "title": "Missing provider scopes",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#missing_provider_scopes"
                    }
                  },
                  "provider_auth_failed": {
                    "summary": "Provider rejected credentials",
                    "value": {
                      "code": "provider_auth_failed",
                      "detail": "The provider rejected the credentials (wrong or expired key, or a key of another company). Kiosa stored nothing.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 422,
                      "title": "Provider rejected credentials",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_auth_failed"
                    }
                  },
                  "validation_failed": {
                    "summary": "Validation failed",
                    "value": {
                      "code": "validation_failed",
                      "detail": "The body or a parameter does not match the schema, for example a missing or unknown field or a location ID that does not belong to this business. invalid_params lists every affected field.",
                      "invalid_params": [
                        {
                          "name": "company_id",
                          "reason": "Required"
                        }
                      ],
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 422,
                      "title": "Validation failed",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#validation_failed"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `validation_failed`, `provider_auth_failed`, `missing_provider_scopes`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "provider_unreachable": {
                    "summary": "Provider unreachable",
                    "value": {
                      "code": "provider_unreachable",
                      "detail": "Kiosa could not reach the provider or received an unexpected response. Retry later; repeating the PUT is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Provider unreachable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_unreachable"
                    }
                  },
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`, `provider_unreachable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:write"
            ]
          }
        ],
        "summary": "Connect an integration",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    },
    "/integrations/{provider}/branch-mappings": {
      "put": {
        "description": "Maps provider branches to Kiosa locations or ignores whole branches. Only the listed branches change. `location_id` must be a location of this business (see `GET /locations`). Once every branch is mapped or ignored, the status changes to `active` and the initial import starts. Mappings by working area are maintained by Kiosa.",
        "operationId": "putIntegrationBranchMappings",
        "parameters": [
          {
            "description": "Integration provider. v1 supports `ordio` only.",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "ordio"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "mappings": [
                  {
                    "branch_id": "4712",
                    "location_id": "cm3loc0000hafen000000002"
                  },
                  {
                    "branch_id": "4713",
                    "ignore": true
                  }
                ]
              },
              "schema": {
                "$ref": "#/components/schemas/BranchMappingRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "api_key_last4": "x9Qa",
                  "branches": [
                    {
                      "branch_id": "4711",
                      "location_id": "cm3loc0000city0000000001",
                      "mapping": "mapped",
                      "name": "Trattoria City",
                      "suggested_location_id": null
                    },
                    {
                      "branch_id": "4712",
                      "location_id": "cm3loc0000hafen000000002",
                      "mapping": "mapped",
                      "name": "Trattoria am Hafen GmbH",
                      "suggested_location_id": null
                    },
                    {
                      "branch_id": "4713",
                      "location_id": null,
                      "mapping": "ignored",
                      "name": "Zentrale Verwaltung",
                      "suggested_location_id": null
                    }
                  ],
                  "company_id": "1234",
                  "connected_at": "2026-11-24T10:15:02+01:00",
                  "initial_import": {
                    "since": "2025-01-01",
                    "status": "running"
                  },
                  "issues": [],
                  "key_expires_at": "2027-11-30T23:59:59+01:00",
                  "last_import": {
                    "finished_at": null,
                    "started_at": "2026-11-24T10:16:40+01:00",
                    "status": "running"
                  },
                  "provider": "ordio",
                  "status": "active"
                },
                "schema": {
                  "$ref": "#/components/schemas/IntegrationWithBranches"
                }
              }
            },
            "description": "Mapping stored; integration status including branches.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "admin_required": {
                    "summary": "Admin required",
                    "value": {
                      "code": "admin_required",
                      "detail": "Write calls require the user who granted access to still be an admin of the business. An admin has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Admin required",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#admin_required"
                    }
                  },
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "provider_not_allowed": {
                    "summary": "Provider not allowed",
                    "value": {
                      "code": "provider_not_allowed",
                      "detail": "This client may not write integrations of this provider. Each partner is approved only for the providers agreed with Kiosa.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Provider not allowed",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_not_allowed"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`, `admin_required`, `provider_not_allowed`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "not_found": {
                    "summary": "Not found",
                    "value": {
                      "code": "not_found",
                      "detail": "The resource does not exist or the provider is not supported by the API.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 404,
                      "title": "Not found",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `not_found`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "mapping_conflict": {
                    "summary": "Mapping conflict",
                    "value": {
                      "code": "mapping_conflict",
                      "detail": "The mapping references branches that no longer belong to the connected company, for example because the credentials changed in the meantime. Fetch the branches again and resend the mapping.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 409,
                      "title": "Mapping conflict",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#mapping_conflict"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `mapping_conflict`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "payload_too_large": {
                    "summary": "Payload too large",
                    "value": {
                      "code": "payload_too_large",
                      "detail": "The request body exceeds 64 KB. Kiosa did not process the request.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 413,
                      "title": "Payload too large",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#payload_too_large"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `payload_too_large`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "validation_failed": {
                    "summary": "Validation failed",
                    "value": {
                      "code": "validation_failed",
                      "detail": "The body or a parameter does not match the schema, for example a missing or unknown field or a location ID that does not belong to this business. invalid_params lists every affected field.",
                      "invalid_params": [
                        {
                          "name": "company_id",
                          "reason": "Required"
                        }
                      ],
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 422,
                      "title": "Validation failed",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#validation_failed"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `validation_failed`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:write"
            ]
          }
        ],
        "summary": "Map branches",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    },
    "/integrations/{provider}/branches": {
      "get": {
        "description": "Returns the branches at the provider with their mapped Kiosa location or a suggestion. If the integration is not connected, the call returns 404 `not_found`.",
        "operationId": "listIntegrationBranches",
        "parameters": [
          {
            "description": "Integration provider. v1 supports `ordio` only.",
            "in": "path",
            "name": "provider",
            "required": true,
            "schema": {
              "enum": [
                "ordio"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "branch_id": "4711",
                      "location_id": "cm3loc0000city0000000001",
                      "mapping": "mapped",
                      "name": "Trattoria City",
                      "suggested_location_id": null
                    },
                    {
                      "branch_id": "4712",
                      "location_id": null,
                      "mapping": "unmapped",
                      "name": "Trattoria am Hafen GmbH",
                      "suggested_location_id": "cm3loc0000hafen000000002"
                    },
                    {
                      "branch_id": "4713",
                      "location_id": null,
                      "mapping": "ignored",
                      "name": "Zentrale Verwaltung",
                      "suggested_location_id": null
                    }
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BranchList"
                }
              }
            },
            "description": "Branches at the provider.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "not_found": {
                    "summary": "Not found",
                    "value": {
                      "code": "not_found",
                      "detail": "The resource does not exist or the provider is not supported by the API.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 404,
                      "title": "Not found",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `not_found`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "provider_unreachable": {
                    "summary": "Provider unreachable",
                    "value": {
                      "code": "provider_unreachable",
                      "detail": "Kiosa could not reach the provider or received an unexpected response. Retry later; repeating the PUT is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Provider unreachable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_unreachable"
                    }
                  },
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`, `provider_unreachable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "integrations:read"
            ]
          }
        ],
        "summary": "List branches",
        "tags": [
          "integrations"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    },
    "/locations": {
      "get": {
        "description": "Returns all locations of the business with ID, name and address. Use the IDs to map provider branches via `PUT /integrations/{provider}/branch-mappings`.",
        "operationId": "listLocations",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "address": {
                        "city": "Hamburg",
                        "country": "DE",
                        "postal_code": "20095",
                        "street": "Musterstraße 1"
                      },
                      "id": "cm3loc0000city0000000001",
                      "name": "Trattoria City"
                    },
                    {
                      "address": {
                        "city": "Hamburg",
                        "country": "DE",
                        "postal_code": "20457",
                        "street": "Hafenweg 7"
                      },
                      "id": "cm3loc0000hafen000000002",
                      "name": "Trattoria am Hafen"
                    }
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/LocationList"
                }
              }
            },
            "description": "All locations of the business.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "account:read"
            ]
          }
        ],
        "summary": "List locations",
        "tags": [
          "account"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    },
    "/me": {
      "get": {
        "description": "Returns the business that granted access, when access was granted and the granted scopes. A good first call after authorization to link the business in your system.",
        "operationId": "getMe",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "account": {
                    "id": "cm3acc0000trattoria00001",
                    "name": "Trattoria Beispiel GmbH",
                    "slug": "trattoria-beispiel"
                  },
                  "consented_at": "2026-11-24T09:30:00+01:00",
                  "scopes": [
                    "account:read",
                    "integrations:write"
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "description": "The connection of the token.",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "invalid_token": {
                    "summary": "Invalid token",
                    "value": {
                      "code": "invalid_token",
                      "detail": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 401,
                      "title": "Invalid token",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `invalid_token`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "insufficient_scope": {
                    "summary": "Insufficient scope",
                    "value": {
                      "code": "insufficient_scope",
                      "detail": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Insufficient scope",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
                    }
                  },
                  "partner_apps_disabled": {
                    "summary": "Partner apps disabled",
                    "value": {
                      "code": "partner_apps_disabled",
                      "detail": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner apps disabled",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
                    }
                  },
                  "partner_not_approved": {
                    "summary": "Partner not approved",
                    "value": {
                      "code": "partner_not_approved",
                      "detail": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner not approved",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
                    }
                  },
                  "partner_suspended": {
                    "summary": "Partner suspended",
                    "value": {
                      "code": "partner_suspended",
                      "detail": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "Partner suspended",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
                    }
                  },
                  "user_inactive": {
                    "summary": "User inactive",
                    "value": {
                      "code": "user_inactive",
                      "detail": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 403,
                      "title": "User inactive",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `insufficient_scope`, `user_inactive`, `partner_not_approved`, `partner_suspended`, `partner_apps_disabled`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "rate_limited": {
                    "summary": "Rate limited",
                    "value": {
                      "code": "rate_limited",
                      "detail": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 429,
                      "title": "Rate limited",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `rate_limited`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "internal_error": {
                    "summary": "Internal error",
                    "value": {
                      "code": "internal_error",
                      "detail": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 500,
                      "title": "Internal error",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `internal_error`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "502": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_unavailable": {
                    "summary": "Upstream unavailable",
                    "value": {
                      "code": "upstream_unavailable",
                      "detail": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 502,
                      "title": "Upstream unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "service_unavailable": {
                    "summary": "Service unavailable",
                    "value": {
                      "code": "service_unavailable",
                      "detail": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 503,
                      "title": "Service unavailable",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `service_unavailable`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "504": {
            "content": {
              "application/problem+json": {
                "examples": {
                  "upstream_timeout": {
                    "summary": "Upstream timeout",
                    "value": {
                      "code": "upstream_timeout",
                      "detail": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
                      "request_id": "req_01JDX5Q8M3V8F2K7ZB9T4N6C1A",
                      "status": 504,
                      "title": "Upstream timeout",
                      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
                    }
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Error: `upstream_timeout`",
            "headers": {
              "RateLimit": {
                "$ref": "#/components/headers/RateLimit"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "account:read"
            ]
          }
        ],
        "summary": "Get the connection",
        "tags": [
          "account"
        ],
        "x-kiosa-availability": "partner_preview"
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "servers": [
    {
      "url": "https://api.kiosa.ai/v1"
    }
  ],
  "tags": [
    {
      "description": "The business and locations your client has access to.",
      "name": "account"
    },
    {
      "description": "Connect, map and disconnect integrations of the business.",
      "name": "integrations"
    }
  ],
  "x-kiosa-errors": {
    "admin_required": {
      "description": "Write calls require the user who granted access to still be an admin of the business. An admin has to grant access again.",
      "status": 403,
      "title": "Admin required",
      "type": "https://docs.kiosa.ai/en/reference/errors/#admin_required"
    },
    "insufficient_scope": {
      "description": "The token does not carry the scope this endpoint requires. Request the scope during authorization; the WWW-Authenticate header names it.",
      "status": 403,
      "title": "Insufficient scope",
      "type": "https://docs.kiosa.ai/en/reference/errors/#insufficient_scope"
    },
    "internal_error": {
      "description": "An unexpected error occurred at Kiosa. Retry later and quote the request_id when contacting support.",
      "status": 500,
      "title": "Internal error",
      "type": "https://docs.kiosa.ai/en/reference/errors/#internal_error"
    },
    "invalid_token": {
      "description": "The access token is missing, expired, revoked or not issued for this API. Use the refresh token to obtain a new access token; if that fails, the business has to grant access again.",
      "status": 401,
      "title": "Invalid token",
      "type": "https://docs.kiosa.ai/en/reference/errors/#invalid_token"
    },
    "mapping_conflict": {
      "description": "The mapping references branches that no longer belong to the connected company, for example because the credentials changed in the meantime. Fetch the branches again and resend the mapping.",
      "status": 409,
      "title": "Mapping conflict",
      "type": "https://docs.kiosa.ai/en/reference/errors/#mapping_conflict"
    },
    "missing_provider_scopes": {
      "description": "The key works but lacks permissions Kiosa needs for the import; missing_scopes lists them. Issue a key with all permissions and submit it again.",
      "status": 422,
      "title": "Missing provider scopes",
      "type": "https://docs.kiosa.ai/en/reference/errors/#missing_provider_scopes"
    },
    "not_found": {
      "description": "The resource does not exist or the provider is not supported by the API.",
      "status": 404,
      "title": "Not found",
      "type": "https://docs.kiosa.ai/en/reference/errors/#not_found"
    },
    "partner_apps_disabled": {
      "description": "The business has turned off partner apps in Kiosa (Settings → Connected apps). Calls are rejected until it turns them back on.",
      "status": 403,
      "title": "Partner apps disabled",
      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_apps_disabled"
    },
    "partner_not_approved": {
      "description": "The Kiosa API is only open to approved partners. Your client is not registered as a partner. Write to kontakt@kiosa.ai to apply for approval. Authorization already rejects such a client (`unauthorized_client`); calls get this code when the token belongs to a partner that has lost its approval since.",
      "status": 403,
      "title": "Partner not approved",
      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_not_approved"
    },
    "partner_suspended": {
      "description": "Kiosa has suspended this client. All of its tokens are rejected with immediate effect.",
      "status": 403,
      "title": "Partner suspended",
      "type": "https://docs.kiosa.ai/en/reference/errors/#partner_suspended"
    },
    "payload_too_large": {
      "description": "The request body exceeds 64 KB. Kiosa did not process the request.",
      "status": 413,
      "title": "Payload too large",
      "type": "https://docs.kiosa.ai/en/reference/errors/#payload_too_large"
    },
    "provider_auth_failed": {
      "description": "The provider rejected the credentials (wrong or expired key, or a key of another company). Kiosa stored nothing.",
      "status": 422,
      "title": "Provider rejected credentials",
      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_auth_failed"
    },
    "provider_not_allowed": {
      "description": "This client may not write integrations of this provider. Each partner is approved only for the providers agreed with Kiosa.",
      "status": 403,
      "title": "Provider not allowed",
      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_not_allowed"
    },
    "provider_unreachable": {
      "description": "Kiosa could not reach the provider or received an unexpected response. Retry later; repeating the PUT is idempotent.",
      "status": 502,
      "title": "Provider unreachable",
      "type": "https://docs.kiosa.ai/en/reference/errors/#provider_unreachable"
    },
    "rate_limited": {
      "description": "Each client may send 60 requests per minute per business. Wait for the number of seconds in the Retry-After header, then retry.",
      "status": 429,
      "title": "Rate limited",
      "type": "https://docs.kiosa.ai/en/reference/errors/#rate_limited"
    },
    "service_unavailable": {
      "description": "Kiosa is temporarily overloaded or unavailable. Wait for the number of seconds in the Retry-After header, if present, then retry.",
      "status": 503,
      "title": "Service unavailable",
      "type": "https://docs.kiosa.ai/en/reference/errors/#service_unavailable"
    },
    "upstream_timeout": {
      "description": "The Kiosa server hosting the business did not respond in time. The matching GET shows whether a write call already took effect; retrying is idempotent.",
      "status": 504,
      "title": "Upstream timeout",
      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_timeout"
    },
    "upstream_unavailable": {
      "description": "The Kiosa server hosting the business could not be reached or sent an invalid response. Retry later; write calls are idempotent.",
      "status": 502,
      "title": "Upstream unavailable",
      "type": "https://docs.kiosa.ai/en/reference/errors/#upstream_unavailable"
    },
    "user_inactive": {
      "description": "The user who granted access has been deactivated, is no longer a member of the business or no longer has a sufficient role. An admin of the business has to grant access again.",
      "status": 403,
      "title": "User inactive",
      "type": "https://docs.kiosa.ai/en/reference/errors/#user_inactive"
    },
    "validation_failed": {
      "description": "The body or a parameter does not match the schema, for example a missing or unknown field or a location ID that does not belong to this business. invalid_params lists every affected field.",
      "status": 422,
      "title": "Validation failed",
      "type": "https://docs.kiosa.ai/en/reference/errors/#validation_failed"
    }
  }
}
