{
  "openapi": "3.1.0",
  "info": {
    "title": "slackwsh API",
    "version": "0.1.0",
    "description": "Generated from libs/contracts — do not hand-edit."
  },
  "servers": [
    {
      "url": "/api"
    }
  ],
  "components": {
    "schemas": {
      "Workspace": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "orgId": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "slug": {
            "type": "string",
            "pattern": "^[a-z0-9-]{2,64}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "iconUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "retentionDays": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        },
        "required": [
          "id",
          "orgId",
          "slug",
          "name",
          "iconUrl",
          "retentionDays"
        ]
      },
      "Channel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "workspaceId": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "public",
              "private",
              "dm",
              "group_dm"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "minLength": 1,
            "maxLength": 80
          },
          "topic": {
            "type": [
              "string",
              "null"
            ]
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "isArchived": {
            "type": "boolean"
          },
          "lastMessageAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "memberCount": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "workspaceId",
          "type",
          "name",
          "topic",
          "purpose",
          "createdBy",
          "isArchived",
          "lastMessageAt",
          "memberCount"
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "workspaceId": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "channelId": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "seq": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "clientMsgId": {
            "type": "string",
            "format": "uuid"
          },
          "authorId": {
            "type": "string",
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "system"
            ]
          },
          "text": {
            "type": "string"
          },
          "blocks": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "v": {
                    "type": "number",
                    "enum": [
                      1
                    ]
                  },
                  "doc": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "v",
                  "doc"
                ]
              }
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
          },
          "isBroadcast": {
            "type": "boolean"
          },
          "threadReplyCount": {
            "type": "integer",
            "minimum": 0
          },
          "threadLastReplyAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "editedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deletedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "workspaceId",
          "channelId",
          "seq",
          "clientMsgId",
          "authorId",
          "type",
          "text",
          "blocks",
          "revision",
          "parentId",
          "isBroadcast",
          "threadReplyCount",
          "threadLastReplyAt",
          "editedAt",
          "deletedAt",
          "createdAt"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Liveness check",
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "service": {
                      "type": "string"
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "status",
                    "service",
                    "time"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/workspaces": {
      "post": {
        "summary": "Create a workspace",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z0-9-]{2,64}$"
                  }
                },
                "required": [
                  "name",
                  "slug"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Workspace created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "orgId": {
                      "type": "string",
                      "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "slug": {
                      "type": "string",
                      "pattern": "^[a-z0-9-]{2,64}$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "iconUrl": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uri"
                    },
                    "retentionDays": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    }
                  },
                  "required": [
                    "id",
                    "orgId",
                    "slug",
                    "name",
                    "iconUrl",
                    "retentionDays"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/workspaces/{workspaceId}/channels": {
      "post": {
        "summary": "Create a channel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "public",
                      "private"
                    ]
                  },
                  "topic": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "type"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Channel created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "workspaceId": {
                      "type": "string",
                      "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "public",
                        "private",
                        "dm",
                        "group_dm"
                      ]
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "topic": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "purpose": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdBy": {
                      "type": "string",
                      "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                    },
                    "isArchived": {
                      "type": "boolean"
                    },
                    "lastMessageAt": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "memberCount": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "id",
                    "workspaceId",
                    "type",
                    "name",
                    "topic",
                    "purpose",
                    "createdBy",
                    "isArchived",
                    "lastMessageAt",
                    "memberCount"
                  ]
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List channels visible to the caller",
        "responses": {
          "200": {
            "description": "Channel list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "channels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "workspaceId": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "public",
                              "private",
                              "dm",
                              "group_dm"
                            ]
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "topic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "purpose": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdBy": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "isArchived": {
                            "type": "boolean"
                          },
                          "lastMessageAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "memberCount": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "id",
                          "workspaceId",
                          "type",
                          "name",
                          "topic",
                          "purpose",
                          "createdBy",
                          "isArchived",
                          "lastMessageAt",
                          "memberCount"
                        ]
                      }
                    }
                  },
                  "required": [
                    "channels"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/channels/{channelId}/messages": {
      "get": {
        "summary": "Scrollback page (§5.3 catch-up mechanism)",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
            },
            "required": true,
            "name": "channelId",
            "in": "path"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "required": false,
            "name": "afterSeq",
            "in": "query"
          },
          {
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "required": false,
            "name": "beforeSeq",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "required": false,
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Message page ordered by seq",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "messages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "workspaceId": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "channelId": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "seq": {
                            "type": "integer",
                            "exclusiveMinimum": 0
                          },
                          "clientMsgId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "authorId": {
                            "type": "string",
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "text",
                              "system"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "blocks": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "v": {
                                    "type": "number",
                                    "enum": [
                                      1
                                    ]
                                  },
                                  "doc": {
                                    "type": "object",
                                    "additionalProperties": {}
                                  }
                                },
                                "required": [
                                  "v",
                                  "doc"
                                ]
                              }
                            ]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "parentId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
                          },
                          "isBroadcast": {
                            "type": "boolean"
                          },
                          "threadReplyCount": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "threadLastReplyAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "editedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "deletedAt": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "workspaceId",
                          "channelId",
                          "seq",
                          "clientMsgId",
                          "authorId",
                          "type",
                          "text",
                          "blocks",
                          "revision",
                          "parentId",
                          "isBroadcast",
                          "threadReplyCount",
                          "threadLastReplyAt",
                          "editedAt",
                          "deletedAt",
                          "createdAt"
                        ]
                      }
                    }
                  },
                  "required": [
                    "messages"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}