{
  "openapi": "3.1.1",
  "info": {
    "title": "LarpTube Developer API",
    "version": "1.5.2",
    "description": "Public read-only API for LarpTube videos, channels, playlists, discovery, live streams, comments, platform status, oEmbed, the browser SDK, and the hosted LarpTube player. Public clients are rate-limited; browser requests from larptube.com use the dedicated partner lane."
  },
  "servers": [
    {
      "url": "https://api.larptube.net"
    }
  ],
  "externalDocs": {
    "description": "LarpTube Developer Docs",
    "url": "https://docs.larptube.net"
  },
  "tags": [
    {
      "name": "Videos"
    },
    {
      "name": "Channels"
    },
    {
      "name": "Playlists"
    },
    {
      "name": "Discovery"
    },
    {
      "name": "Live"
    },
    {
      "name": "Platform"
    },
    {
      "name": "Embeds"
    }
  ],
  "paths": {
    "/v1/videos": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "List and filter public videos",
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "latest",
                "trending",
                "views",
                "likes"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "creator",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "duration",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "short",
                "medium",
                "long"
              ]
            }
          },
          {
            "name": "feature",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "3d",
                "calm",
                "restricted",
                "captions"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Video list"
          }
        }
      }
    },
    "/v1/videos/batch": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "Fetch up to 50 videos by ID",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch video response"
          }
        }
      }
    },
    "/v1/videos/{id}": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "Get one video",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Video",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "id",
                        "title",
                        "thumbnailUrl",
                        "watchUrl",
                        "embedUrl",
                        "creator"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "duration": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "durationText": {
                          "type": "string"
                        },
                        "views": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "likes": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "comments": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "publishedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "privacy": {
                          "type": "string"
                        },
                        "thumbnailUrl": {
                          "type": "string",
                          "format": "uri"
                        },
                        "watchUrl": {
                          "type": "string",
                          "format": "uri"
                        },
                        "embedUrl": {
                          "type": "string",
                          "format": "uri"
                        },
                        "features": {
                          "type": "object"
                        },
                        "creator": {
                          "type": "object",
                          "properties": {
                            "username": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "avatarUrl": {
                              "type": "string",
                              "format": "uri"
                            },
                            "channelUrl": {
                              "type": "string",
                              "format": "uri"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/v1/videos/{id}/playback": {
      "get": {
        "tags": [
          "Embeds"
        ],
        "summary": "Get player modes, qualities, 3D, Calm Audio and Restricted Mode availability",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Playback capabilities"
          }
        }
      }
    },
    "/v1/videos/{id}/related": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "summary": "Get related public videos",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Related videos"
          }
        }
      }
    },
    "/v1/videos/{id}/comments": {
      "get": {
        "tags": [
          "Videos"
        ],
        "summary": "List published public comments and replies",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Video comments"
          }
        }
      }
    },
    "/v1/channels": {
      "get": {
        "tags": [
          "Channels"
        ],
        "summary": "Discover public channels",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "subscribers",
                "views",
                "videos"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel list"
          }
        }
      }
    },
    "/v1/channels/{username}": {
      "get": {
        "tags": [
          "Channels"
        ],
        "summary": "Get a public channel",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel"
          }
        }
      }
    },
    "/v1/channels/{username}/videos": {
      "get": {
        "tags": [
          "Channels"
        ],
        "summary": "List a channel’s public videos",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel videos"
          }
        }
      }
    },
    "/v1/channels/{username}/playlists": {
      "get": {
        "tags": [
          "Playlists"
        ],
        "summary": "List a channel’s public playlists",
        "parameters": [
          {
            "name": "username",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel playlists"
          }
        }
      }
    },
    "/v1/playlists/{id}": {
      "get": {
        "tags": [
          "Playlists"
        ],
        "summary": "Get a public or unlisted playlist by ID",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Playlist"
          }
        }
      }
    },
    "/v1/playlists/{id}/videos": {
      "get": {
        "tags": [
          "Playlists"
        ],
        "summary": "List videos in a public or unlisted playlist",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Playlist videos"
          }
        }
      }
    },
    "/v1/discovery": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "summary": "Get one-call discovery shelves: latest, trending, feature-ready, categories and live",
        "responses": {
          "200": {
            "description": "Discovery payload"
          }
        }
      }
    },
    "/v1/categories": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "summary": "List categories with public-video counts",
        "responses": {
          "200": {
            "description": "Categories"
          }
        }
      }
    },
    "/v1/search": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "summary": "Search videos, channels, playlists, or all resources",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "videos",
                "channels",
                "playlists",
                "all"
              ],
              "default": "videos"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results"
          }
        }
      }
    },
    "/v1/live": {
      "get": {
        "tags": [
          "Live"
        ],
        "summary": "List live public channels",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "live",
                "all"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Live channels"
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "tags": [
          "Platform"
        ],
        "summary": "Read automatically detected LarpTube service health and active status alerts",
        "responses": {
          "200": {
            "description": "Status"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "tags": [
          "Platform"
        ],
        "summary": "Developer API health check",
        "responses": {
          "200": {
            "description": "Health"
          }
        }
      }
    },
    "/sdk.js": {
      "get": {
        "tags": [
          "Platform"
        ],
        "summary": "Browser SDK for the public API and embeds",
        "responses": {
          "200": {
            "description": "JavaScript SDK"
          }
        }
      }
    },
    "/oembed": {
      "get": {
        "tags": [
          "Embeds"
        ],
        "summary": "Resolve a LarpTube URL into oEmbed video HTML",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "maxwidth",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 200,
              "maximum": 1920
            }
          }
        ],
        "responses": {
          "200": {
            "description": "oEmbed response"
          }
        }
      }
    },
    "/v1/partner": {
      "get": {
        "tags": [
          "Platform"
        ],
        "summary": "Read stats for an authenticated developer app",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Partner stats"
          },
          "401": {
            "description": "API key required"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "LarpTube developer key"
      }
    },
    "schemas": {
      "Video": {
        "type": "object",
        "required": [
          "id",
          "title",
          "thumbnailUrl",
          "watchUrl",
          "embedUrl",
          "creator"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "duration": {
            "type": "integer",
            "minimum": 0
          },
          "durationText": {
            "type": "string"
          },
          "views": {
            "type": "integer",
            "minimum": 0
          },
          "likes": {
            "type": "integer",
            "minimum": 0
          },
          "comments": {
            "type": "integer",
            "minimum": 0
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "privacy": {
            "type": "string"
          },
          "thumbnailUrl": {
            "type": "string",
            "format": "uri"
          },
          "watchUrl": {
            "type": "string",
            "format": "uri"
          },
          "embedUrl": {
            "type": "string",
            "format": "uri"
          },
          "features": {
            "type": "object"
          },
          "creator": {
            "type": "object",
            "properties": {
              "username": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "avatarUrl": {
                "type": "string",
                "format": "uri"
              },
              "channelUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}