{
    "openapi": "3.1.2",
    "info": {
        "title": "Socket Chief API v1",
        "version": "1.0.0",
        "description": "Manage the authenticated team's Pusher compatible WebSocket apps and their webhooks, and observe their live channels and usage."
    },
    "servers": [
        {
            "url": "https:\/\/socket.chief.app\/api\/v1"
        }
    ],
    "tags": [
        {
            "name": "Team",
            "description": "The team the request acts on, with its plan limits and their usage."
        },
        {
            "name": "Apps",
            "description": "Endpoints for the apps of the team. Each app has its own credentials that Pusher compatible clients and server libraries connect with."
        },
        {
            "name": "Webhooks",
            "description": "Endpoints for the webhooks of an app. Socket Chief delivers channel, presence and client events to their URL, signed with the app secret like Pusher webhooks."
        },
        {
            "name": "Usage",
            "description": "Usage of the apps of the team, recorded by the WebSocket server every minute and aggregated per hour and per day (UTC)."
        }
    ],
    "security": [
        {
            "ctp": []
        },
        {
            "openid": []
        },
        {
            "ctt": []
        }
    ],
    "paths": {
        "\/team": {
            "get": {
                "operationId": "team.single",
                "description": "Get the team the token acts on, with its plan limits and their usage. Any Socket Chief read scope grants access.",
                "summary": "Get the team",
                "tags": [
                    "Team"
                ],
                "responses": {
                    "200": {
                        "description": "`Team`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/Team"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "openid": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "openid": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:usage:read"
                        ]
                    }
                ]
            }
        },
        "\/apps": {
            "get": {
                "operationId": "apps.index",
                "description": "List the team's apps by name.",
                "summary": "List apps",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "query",
                        "in": "query",
                        "description": "Search results by name.",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        },
                        "example": "production"
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of results per page.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number to return.",
                        "schema": {
                            "type": "integer",
                            "default": 1,
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `App`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/App"
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "first": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "first",
                                                "last",
                                                "prev",
                                                "next"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "from": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "links": {
                                                    "type": "array",
                                                    "description": "Generated paginator links.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "url": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            }
                                                        },
                                                        "required": [
                                                            "url",
                                                            "label",
                                                            "active"
                                                        ]
                                                    }
                                                },
                                                "path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Base path for paginator generated URLs."
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "description": "Number of items shown per page.",
                                                    "minimum": 0
                                                },
                                                "to": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Number of the last item in the slice.",
                                                    "minimum": 1
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of items being paginated.",
                                                    "minimum": 0
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "from",
                                                "last_page",
                                                "links",
                                                "path",
                                                "per_page",
                                                "to",
                                                "total"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "links",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:read"
                        ]
                    }
                ]
            },
            "post": {
                "operationId": "apps.create",
                "description": "Create an app with its own credentials. The response includes the credentials, which can be read again with the credentials endpoint.",
                "summary": "Create an app",
                "tags": [
                    "Apps"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/SaveAppRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The app was created.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/App"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "The team reached the app limit of its plan.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "code": {
                                            "type": "string",
                                            "const": "limit_reached"
                                        }
                                    },
                                    "required": [
                                        "message",
                                        "code"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:write"
                        ]
                    }
                ]
            }
        },
        "\/apps\/{app}\/webhooks": {
            "get": {
                "operationId": "webhooks.index",
                "description": "List the webhooks of an app by URL.",
                "summary": "List webhooks",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "query",
                        "in": "query",
                        "description": "Search results by name.",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        },
                        "example": "production"
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of results per page.",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number to return.",
                        "schema": {
                            "type": "integer",
                            "default": 1,
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated set of `Webhook`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#\/components\/schemas\/Webhook"
                                            }
                                        },
                                        "links": {
                                            "type": "object",
                                            "properties": {
                                                "first": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "last": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prev": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "first",
                                                "last",
                                                "prev",
                                                "next"
                                            ]
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "from": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1
                                                },
                                                "last_page": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                },
                                                "links": {
                                                    "type": "array",
                                                    "description": "Generated paginator links.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "url": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "active": {
                                                                "type": "boolean"
                                                            }
                                                        },
                                                        "required": [
                                                            "url",
                                                            "label",
                                                            "active"
                                                        ]
                                                    }
                                                },
                                                "path": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Base path for paginator generated URLs."
                                                },
                                                "per_page": {
                                                    "type": "integer",
                                                    "description": "Number of items shown per page.",
                                                    "minimum": 0
                                                },
                                                "to": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Number of the last item in the slice.",
                                                    "minimum": 1
                                                },
                                                "total": {
                                                    "type": "integer",
                                                    "description": "Total number of items being paginated.",
                                                    "minimum": 0
                                                }
                                            },
                                            "required": [
                                                "current_page",
                                                "from",
                                                "last_page",
                                                "links",
                                                "path",
                                                "per_page",
                                                "to",
                                                "total"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "links",
                                        "meta"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:read"
                        ]
                    }
                ]
            },
            "post": {
                "operationId": "webhooks.create",
                "description": "Add a webhook to an app. It only receives deliveries once it has at least one event.",
                "summary": "Create a webhook",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/SaveWebhookRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "The webhook was created.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/Webhook"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:write"
                        ]
                    }
                ]
            }
        },
        "\/usage": {
            "get": {
                "operationId": "usage.summary",
                "description": "Get the totals of the team since the first day of the period with a breakdown per app, the peak concurrent connections and the connections right now. The period starts on the first day of the current month unless from is given, and always covers whole UTC days.",
                "summary": "Get the usage summary",
                "tags": [
                    "Usage"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "description": "First day (UTC) of the period, at most 366 days ago. The start of the current month when left out.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-10-01"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`UsageSummary`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/UsageSummary"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:usage:read"
                        ]
                    }
                ]
            }
        },
        "\/apps\/{app}": {
            "get": {
                "operationId": "apps.single",
                "description": "Get one of the team's apps. The secret is not included, read it with the credentials endpoint.",
                "summary": "Get an app",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`App`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/App"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:read"
                        ]
                    }
                ]
            },
            "patch": {
                "operationId": "apps.update",
                "description": "Rename an app or change the channel types and client events it allows. Fields left out keep their value.",
                "summary": "Update an app",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/SaveAppRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`App`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/App"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:write"
                        ]
                    }
                ]
            },
            "delete": {
                "operationId": "apps.delete",
                "description": "Delete an app with its webhooks and usage history. Its credentials stop working and its webhooks stop receiving deliveries. This cannot be undone.",
                "summary": "Delete an app",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "The app was deleted.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:write"
                        ]
                    }
                ]
            }
        },
        "\/apps\/{app}\/credentials": {
            "get": {
                "operationId": "apps.credentials",
                "description": "Get the app ID, key and secret with the host and port to connect to. The secret signs server API requests and channel authorizations, so this requires the apps write scope.",
                "summary": "Get the app credentials",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`AppCredentials`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/AppCredentials"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:apps:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:apps:write"
                        ]
                    }
                ]
            }
        },
        "\/apps\/{app}\/channels": {
            "get": {
                "operationId": "apps.channels",
                "description": "List the channels of the app that have subscribers right now, with their subscription and presence user counts. The WebSocket server is asked at most every few seconds, pass fresh to skip the cached snapshot. When the server cannot be reached the status is unavailable and the channel list is empty.",
                "summary": "List live channels",
                "tags": [
                    "Apps"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "query",
                        "in": "query",
                        "description": "Only return channels whose name contains this text, case-insensitive.",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        },
                        "example": "orders"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Only return channels of this type, or with this cache or encrypted modifier.",
                        "schema": {
                            "anyOf": [
                                {
                                    "$ref": "#\/components\/schemas\/ChannelType"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "example": "presence"
                    },
                    {
                        "name": "fresh",
                        "in": "query",
                        "description": "Read the channels from the WebSocket server instead of the snapshot cached for a few seconds.",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`AppChannels`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/AppChannels"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:usage:read"
                        ]
                    }
                ]
            }
        },
        "\/usage\/history": {
            "get": {
                "operationId": "usage.history",
                "description": "Get the usage of the team per day (at most 92 days) or per hour (at most 168 hours), periods without usage included with zeros. Hourly usage is kept for 13 months. The peak connections of a period are the sum of the app peaks, an upper bound for teams with more than one app.",
                "summary": "Get the usage history",
                "tags": [
                    "Usage"
                ],
                "parameters": [
                    {
                        "name": "interval",
                        "in": "query",
                        "description": "day for one entry per UTC day, hour for one entry per hour.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "day",
                                "hour"
                            ],
                            "default": "day"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "description": "Start of the history (UTC), as a date or date-time. The last 30 days or the last 24 hours when left out.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "example": "2026-10-01"
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "description": "End of the history (UTC), as a date or date-time, inclusive. Now when left out.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "example": "2026-10-31"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`UsageHistory`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/UsageHistory"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:usage:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:usage:read"
                        ]
                    }
                ]
            }
        },
        "\/apps\/{app}\/webhooks\/{webhook}": {
            "get": {
                "operationId": "webhooks.single",
                "description": "Get one of the webhooks of an app.",
                "summary": "Get a webhook",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "webhook",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`Webhook`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/Webhook"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:read"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:read"
                        ]
                    }
                ]
            },
            "patch": {
                "operationId": "webhooks.update",
                "description": "Change the URL, events, headers, query parameters or channel filters of a webhook. Fields left out keep their value, a given field replaces the current value entirely: send the complete headers object to change one header. Send null or an empty value to clear a field.",
                "summary": "Update a webhook",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "webhook",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/SaveWebhookRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`Webhook`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/Webhook"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:write"
                        ]
                    }
                ]
            },
            "delete": {
                "operationId": "webhooks.delete",
                "description": "Delete a webhook of an app, it stops receiving deliveries.",
                "summary": "Delete a webhook",
                "tags": [
                    "Webhooks"
                ],
                "parameters": [
                    {
                        "name": "app",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "webhook",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "The webhook was deleted.",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#\/components\/responses\/ModelNotFoundException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                },
                "security": [
                    {
                        "openid": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctp": [
                            "socketchief:webhooks:write"
                        ]
                    },
                    {
                        "ctt": [
                            "socketchief:webhooks:write"
                        ]
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ctp": {
                "type": "http",
                "description": "Chief Tools personal access token.",
                "scheme": "bearer",
                "bearerFormat": "ctp_*"
            },
            "openid": {
                "type": "openIdConnect",
                "openIdConnectUrl": "https:\/\/account.chief.app\/.well-known\/openid-configuration"
            },
            "ctt": {
                "type": "http",
                "description": "Chief Tools team access token.",
                "scheme": "bearer",
                "bearerFormat": "ctt_*"
            }
        },
        "schemas": {
            "App": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "App ID, which is also the app key Pusher clients connect with.",
                        "examples": [
                            "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                        ]
                    },
                    "name": {
                        "type": "string",
                        "examples": [
                            "Production"
                        ]
                    },
                    "channel_types": {
                        "type": "array",
                        "description": "Channel types clients may subscribe to.",
                        "items": {
                            "$ref": "#\/components\/schemas\/ChannelType"
                        }
                    },
                    "client_events": {
                        "type": "boolean",
                        "description": "Whether clients may publish client events on private and presence channels."
                    },
                    "webhooks_count": {
                        "type": "integer",
                        "description": "Number of webhooks of the app."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "updated_at": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "credentials": {
                        "type": "object",
                        "description": "The credentials of the app, only included in the response that created it. Use the credentials endpoint to read them again.",
                        "properties": {
                            "app_id": {
                                "type": "string",
                                "description": "App ID for server libraries.",
                                "examples": [
                                    "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                                ]
                            },
                            "key": {
                                "type": "string",
                                "description": "App key that clients and server libraries connect with, the same value as the app ID.",
                                "examples": [
                                    "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                                ]
                            },
                            "secret": {
                                "type": "string",
                                "description": "App secret that server libraries sign API requests and channel authorizations with. Keep it on the server, never ship it to clients."
                            },
                            "host": {
                                "type": "string",
                                "description": "Host to connect to: the wsHost of clients and the host of server libraries.",
                                "examples": [
                                    "socket.chieftools.cloud"
                                ]
                            },
                            "port": {
                                "type": "integer",
                                "description": "Port to connect to, always with TLS (forceTLS or https).",
                                "examples": [
                                    443
                                ]
                            }
                        },
                        "required": [
                            "app_id",
                            "key",
                            "secret",
                            "host",
                            "port"
                        ]
                    }
                },
                "required": [
                    "id",
                    "name",
                    "channel_types",
                    "client_events",
                    "created_at",
                    "updated_at"
                ],
                "title": "App"
            },
            "AppChannels": {
                "type": "object",
                "properties": {
                    "app_id": {
                        "type": "string",
                        "description": "ID of the app.",
                        "examples": [
                            "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "description": "available when the WebSocket server answered, unavailable when it could not be reached and error says why.",
                        "enum": [
                            "available",
                            "unavailable"
                        ]
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The reason the channels are unavailable, null when they are available."
                    },
                    "refreshed_at": {
                        "type": "string",
                        "description": "When the WebSocket server was asked for the channels."
                    },
                    "metrics": {
                        "type": "object",
                        "description": "Totals over every occupied channel of the app, regardless of the filters.",
                        "properties": {
                            "occupied_channels": {
                                "type": "integer"
                            },
                            "public_channels": {
                                "type": "integer"
                            },
                            "private_channels": {
                                "type": "integer"
                            },
                            "presence_channels": {
                                "type": "integer"
                            },
                            "cache_channels": {
                                "type": "integer"
                            },
                            "encrypted_channels": {
                                "type": "integer"
                            },
                            "presence_users": {
                                "type": "integer",
                                "description": "Users in all presence channels together, a user in two channels counts twice.",
                                "const": 0
                            },
                            "subscriptions": {
                                "type": "integer",
                                "description": "Subscriptions over the channels that reported a subscription count.",
                                "const": 0
                            }
                        },
                        "required": [
                            "occupied_channels",
                            "public_channels",
                            "private_channels",
                            "presence_channels",
                            "cache_channels",
                            "encrypted_channels",
                            "presence_users",
                            "subscriptions"
                        ]
                    },
                    "channels": {
                        "type": "array",
                        "description": "The occupied channels, sorted by name.",
                        "items": {}
                    }
                },
                "required": [
                    "app_id",
                    "status",
                    "error",
                    "refreshed_at",
                    "metrics",
                    "channels"
                ],
                "title": "AppChannels"
            },
            "AppCredentials": {
                "type": "object",
                "properties": {
                    "app_id": {
                        "type": "string",
                        "description": "App ID for server libraries.",
                        "examples": [
                            "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                        ]
                    },
                    "key": {
                        "type": "string",
                        "description": "App key that clients and server libraries connect with, the same value as the app ID.",
                        "examples": [
                            "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                        ]
                    },
                    "secret": {
                        "type": "string",
                        "description": "App secret that server libraries sign API requests and channel authorizations with. Keep it on the server, never ship it to clients."
                    },
                    "host": {
                        "type": "string",
                        "description": "Host to connect to: the wsHost of clients and the host of server libraries.",
                        "examples": [
                            "socket.chieftools.cloud"
                        ]
                    },
                    "port": {
                        "type": "integer",
                        "description": "Port to connect to, always with TLS (forceTLS or https).",
                        "examples": [
                            443
                        ]
                    }
                },
                "required": [
                    "app_id",
                    "key",
                    "secret",
                    "host",
                    "port"
                ],
                "title": "AppCredentials"
            },
            "ChannelType": {
                "type": "string",
                "enum": [
                    "public",
                    "private",
                    "presence",
                    "cache",
                    "encrypted"
                ],
                "title": "ChannelType"
            },
            "SaveAppRequest": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "description": "Display name of the app.",
                        "examples": [
                            "Production"
                        ],
                        "maxLength": 255
                    },
                    "channel_types": {
                        "type": "array",
                        "description": "Channel types clients may subscribe to. New apps allow private and presence channels when left out.",
                        "examples": [
                            [
                                "private",
                                "presence"
                            ]
                        ],
                        "items": {
                            "description": "A channel type: public, private, presence, or the cache and encrypted variants.",
                            "$ref": "#\/components\/schemas\/ChannelType"
                        },
                        "uniqueItems": true
                    },
                    "client_events": {
                        "type": "boolean",
                        "description": "Whether clients may publish client events on private and presence channels. New apps do not allow them when left out."
                    }
                },
                "required": [
                    "name"
                ],
                "title": "SaveAppRequest"
            },
            "SaveWebhookRequest": {
                "type": "object",
                "properties": {
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "HTTPS URL the webhook is delivered to.",
                        "examples": [
                            "https:\/\/example.com\/webhooks\/pusher"
                        ],
                        "maxLength": 255
                    },
                    "events": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Events delivered to the URL. A webhook without events receives nothing.",
                        "examples": [
                            [
                                "channel_occupied",
                                "channel_vacated"
                            ]
                        ],
                        "items": {
                            "description": "An event: channel_occupied, channel_vacated, member_added, member_removed or client_event.",
                            "$ref": "#\/components\/schemas\/WebhookEvent"
                        },
                        "uniqueItems": true
                    },
                    "headers": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "HTTP headers sent with every delivery, as an object of header names to values.",
                        "examples": [
                            {
                                "Authorization": "Bearer my-webhook-token"
                            }
                        ],
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "maxItems": 50
                    },
                    "query_params": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Query parameters added to the URL of every delivery, as an object of names to values.",
                        "examples": [
                            {
                                "source": "socketchief"
                            }
                        ],
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "maxItems": 50
                    },
                    "channel_prefixes": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Only deliver events of channels whose name starts with one of these prefixes. Empty delivers events of every channel.",
                        "examples": [
                            [
                                "private-orders."
                            ]
                        ],
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "maxItems": 50,
                        "uniqueItems": true
                    },
                    "channel_suffixes": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "Only deliver events of channels whose name ends with one of these suffixes. Empty delivers events of every channel.",
                        "examples": [
                            [
                                ".updates"
                            ]
                        ],
                        "items": {
                            "type": "string",
                            "maxLength": 255
                        },
                        "maxItems": 50,
                        "uniqueItems": true
                    }
                },
                "required": [
                    "url"
                ],
                "title": "SaveWebhookRequest"
            },
            "Team": {
                "type": "object",
                "properties": {
                    "slug": {
                        "type": "string",
                        "description": "Team slug, the value of the X-Chief-Team header.",
                        "examples": [
                            "acme"
                        ]
                    },
                    "name": {
                        "type": "string",
                        "examples": [
                            "Acme"
                        ]
                    },
                    "limits": {
                        "type": "object",
                        "description": "The plan limits of the team. A null limit is unlimited.",
                        "properties": {
                            "apps": {
                                "type": "object",
                                "properties": {
                                    "limit": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "Apps the team may have, null for unlimited."
                                    },
                                    "usage": {
                                        "type": "integer"
                                    }
                                },
                                "required": [
                                    "limit",
                                    "usage"
                                ]
                            }
                        },
                        "required": [
                            "apps"
                        ]
                    }
                },
                "required": [
                    "slug",
                    "name",
                    "limits"
                ],
                "title": "Team"
            },
            "UsageHistory": {
                "type": "object",
                "properties": {
                    "interval": {
                        "type": "string",
                        "description": "The length of each period.",
                        "enum": [
                            "day",
                            "hour"
                        ]
                    },
                    "periods": {
                        "type": "array",
                        "description": "One entry per period, oldest first.",
                        "items": {}
                    }
                },
                "required": [
                    "interval",
                    "periods"
                ],
                "title": "UsageHistory"
            },
            "UsageSummary": {
                "type": "object",
                "properties": {
                    "from": {
                        "type": "string",
                        "description": "First day of the period, the totals run until now."
                    },
                    "connected_now": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Connections of all apps right now, null when the WebSocket server cannot be reached."
                    },
                    "peak_connections": {
                        "type": "integer",
                        "description": "Highest concurrent connections of the team in the period, the sum of the hourly app peaks."
                    },
                    "last_recorded_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Start of the most recent minute with recorded usage, null when no usage was recorded yet."
                    },
                    "totals": {
                        "type": "object",
                        "description": "Totals of all apps in the period.",
                        "properties": {
                            "messages_delivered": {
                                "description": "Messages delivered to subscribed connections."
                            },
                            "client_messages_received": {
                                "description": "Client events received from connections."
                            },
                            "api_requests": {
                                "description": "Requests to the HTTP API."
                            },
                            "api_events_published": {
                                "description": "Events published through the HTTP API."
                            },
                            "connections_opened": {},
                            "connection_seconds": {
                                "description": "Total time connections were open, in seconds."
                            },
                            "bytes_in": {},
                            "bytes_out": {},
                            "webhooks_delivered": {},
                            "webhooks_failed": {},
                            "rejected_rate_limited": {
                                "description": "Connections and messages rejected because they exceeded a rate limit."
                            },
                            "rejected_connections": {},
                            "rejected_subscriptions": {}
                        },
                        "required": [
                            "messages_delivered",
                            "client_messages_received",
                            "api_requests",
                            "api_events_published",
                            "connections_opened",
                            "connection_seconds",
                            "bytes_in",
                            "bytes_out",
                            "webhooks_delivered",
                            "webhooks_failed",
                            "rejected_rate_limited",
                            "rejected_connections",
                            "rejected_subscriptions"
                        ]
                    },
                    "apps": {
                        "type": "array",
                        "description": "Usage per app in the period, the apps with the most delivered messages first.",
                        "items": {}
                    }
                },
                "required": [
                    "from",
                    "connected_now",
                    "peak_connections",
                    "last_recorded_at",
                    "totals",
                    "apps"
                ],
                "title": "UsageSummary"
            },
            "Webhook": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "Webhook ID.",
                        "examples": [
                            "01jbqv2k8m4n6p8r0t2v4x6z8a"
                        ]
                    },
                    "app_id": {
                        "type": "string",
                        "description": "ID of the app the webhook belongs to.",
                        "examples": [
                            "9d8f6a52-3c1e-4b7a-9f2d-5e6c7b8a9d0e"
                        ]
                    },
                    "url": {
                        "type": "string",
                        "examples": [
                            "https:\/\/example.com\/webhooks\/pusher"
                        ]
                    },
                    "enabled": {
                        "type": "boolean",
                        "description": "Whether the webhook has events and receives deliveries."
                    },
                    "events": {
                        "type": "array",
                        "description": "Events delivered to the URL.",
                        "items": {
                            "$ref": "#\/components\/schemas\/WebhookEvent"
                        }
                    },
                    "headers": {
                        "type": "object",
                        "description": "HTTP headers sent with every delivery.",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "query_params": {
                        "type": "object",
                        "description": "Query parameters added to the URL of every delivery.",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "channel_prefixes": {
                        "type": "array",
                        "description": "Only events of channels whose name starts with one of these prefixes are delivered, empty for every channel.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "channel_suffixes": {
                        "type": "array",
                        "description": "Only events of channels whose name ends with one of these suffixes are delivered, empty for every channel.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "updated_at": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "app_id",
                    "url",
                    "enabled",
                    "events",
                    "headers",
                    "query_params",
                    "channel_prefixes",
                    "channel_suffixes",
                    "created_at",
                    "updated_at"
                ],
                "title": "Webhook"
            },
            "WebhookEvent": {
                "type": "string",
                "enum": [
                    "channel_occupied",
                    "channel_vacated",
                    "member_added",
                    "member_removed",
                    "client_event"
                ],
                "title": "WebhookEvent"
            }
        },
        "responses": {
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        }
    }
}