{
  "openapi": "3.0.3",
  "info": {
    "title": "TheSpaceLaunches API",
    "description": "REST API for orbital launches, rockets, launch sites, and mission data. Authenticated with API keys. Free tier included.",
    "version": "1.0.0",
    "contact": { "name": "TheSpaceLaunches Developer Support", "url": "https://www.thespacelaunches.cn/developers.html" }
  },
  "servers": [
    { "url": "https://api.thespacelaunches.cn/api/v1", "description": "Production" }
  ],
  "security": [{ "ApiKeyAuth": [] }],
  "tags": [
    { "name": "Auth", "description": "Developer registration, login, and session" },
    { "name": "Account", "description": "Current developer account and API keys" },
    { "name": "Launches", "description": "Launch mission data" },
    { "name": "Rockets", "description": "Rocket specifications and history" },
    { "name": "Launch Sites", "description": "Launch sites and pads" },
    { "name": "Mission Types", "description": "Mission taxonomy" },
    { "name": "Media", "description": "Media assets (PRO+)" },
    { "name": "Subscriptions", "description": "Plans, checkout, billing, and usage" },
    { "name": "Webhooks", "description": "Outbound webhook configuration (PRO+)" }
  ],
  "paths": {
    "/auth/signup": {
      "post": {
        "tags": ["Auth"],
        "summary": "Register a developer account",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SignupRequest" } } }
        },
        "responses": {
          "200": { "description": "Account created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeveloperProfile" } } } },
          "409": { "$ref": "#/components/responses/Conflict" },
          "422": { "$ref": "#/components/responses/ValidationError" }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": ["Auth"],
        "summary": "Log in and start a customer session",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LoginRequest" } } }
        },
        "responses": {
          "204": { "description": "Session cookie set" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/auth/logout": {
      "post": {
        "tags": ["Auth"],
        "summary": "Log out",
        "responses": { "204": { "description": "Session cleared" } }
      }
    },
    "/me": {
      "get": {
        "tags": ["Account"],
        "summary": "Current developer profile",
        "responses": {
          "200": { "description": "Profile", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeveloperProfile" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api-keys": {
      "get": {
        "tags": ["Account"],
        "summary": "List API keys",
        "responses": {
          "200": { "description": "List of keys", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiKeyList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      },
      "post": {
        "tags": ["Account"],
        "summary": "Create an API key",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateApiKeyRequest" } } }
        },
        "responses": {
          "201": { "description": "Key created (plaintext shown once)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiKeyCreated" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      }
    },
    "/api-keys/{id}": {
      "delete": {
        "tags": ["Account"],
        "summary": "Revoke an API key",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "204": { "description": "Key revoked" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": ["Subscriptions"],
        "summary": "Current usage overview",
        "responses": {
          "200": { "description": "Usage summary", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsageOverview" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/usage/daily": {
      "get": {
        "tags": ["Subscriptions"],
        "summary": "Daily usage series",
        "parameters": [
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" }
        ],
        "responses": {
          "200": { "description": "Daily usage", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DailyUsageList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/subscriptions": {
      "get": {
        "tags": ["Subscriptions"],
        "summary": "List subscriptions",
        "responses": {
          "200": { "description": "Subscriptions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SubscriptionList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/subscriptions/{id}/cancel": {
      "post": {
        "tags": ["Subscriptions"],
        "summary": "Cancel subscription at period end",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "200": { "description": "Cancellation scheduled" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "409": { "$ref": "#/components/responses/Conflict" }
        }
      }
    },
    "/subscriptions/{id}/change": {
      "post": {
        "tags": ["Subscriptions"],
        "summary": "Upgrade or downgrade subscription",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeSubscriptionRequest" } } }
        },
        "responses": {
          "200": { "description": "Change processed" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "422": { "$ref": "#/components/responses/ValidationError" }
        }
      }
    },
    "/checkout/session": {
      "post": {
        "tags": ["Subscriptions"],
        "summary": "Create a checkout session",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutRequest" } } }
        },
        "responses": {
          "201": { "description": "Checkout session", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckoutSession" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "422": { "$ref": "#/components/responses/ValidationError" }
        }
      }
    },
    "/invoices": {
      "get": {
        "tags": ["Subscriptions"],
        "summary": "List invoices",
        "parameters": [
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" }
        ],
        "responses": {
          "200": { "description": "Invoices", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InvoiceList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/payment-methods": {
      "get": {
        "tags": ["Subscriptions"],
        "summary": "List saved payment methods",
        "responses": {
          "200": { "description": "Payment methods", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentMethodList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/playground/token": {
      "post": {
        "tags": ["Auth"],
        "summary": "Issue an anonymous playground token",
        "responses": {
          "201": { "description": "Short-lived token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaygroundToken" } } } },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/launches": {
      "get": {
        "tags": ["Launches"],
        "summary": "List launches",
        "parameters": [
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" },
          { "$ref": "#/components/parameters/Sort" },
          { "name": "status", "in": "query", "schema": { "type": "string", "enum": ["SCHEDULED","DELAYED","SCRUBBED","LAUNCHING","LAUNCHED","SUCCESS","FAILED","CANCELLED"] } },
          { "name": "rocket_id", "in": "query", "schema": { "type": "string" } },
          { "name": "launch_site_id", "in": "query", "schema": { "type": "string" } },
          { "name": "q", "in": "query", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "List of missions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionList" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launches/{id}": {
      "get": {
        "tags": ["Launches"],
        "summary": "Get a launch mission detail",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "200": { "description": "Mission detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionDetail" } } } },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launches/upcoming": {
      "get": {
        "tags": ["Launches"],
        "summary": "Upcoming launches",
        "parameters": [{ "$ref": "#/components/parameters/Limit" }],
        "responses": {
          "200": { "description": "Upcoming missions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launches/recent": {
      "get": {
        "tags": ["Launches"],
        "summary": "Recent launches",
        "parameters": [{ "$ref": "#/components/parameters/Limit" }],
        "responses": {
          "200": { "description": "Recent missions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/rockets": {
      "get": {
        "tags": ["Rockets"],
        "summary": "List rockets",
        "parameters": [
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" },
          { "$ref": "#/components/parameters/Sort" }
        ],
        "responses": {
          "200": { "description": "Rocket list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RocketList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/rockets/{id}": {
      "get": {
        "tags": ["Rockets"],
        "summary": "Rocket detail",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "200": { "description": "Rocket detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rocket" } } } },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/rockets/{id}/launches": {
      "get": {
        "tags": ["Rockets"],
        "summary": "Historical launches for a rocket",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }, { "$ref": "#/components/parameters/Page" }, { "$ref": "#/components/parameters/Limit" }],
        "responses": {
          "200": { "description": "Mission list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launch-sites": {
      "get": {
        "tags": ["Launch Sites"],
        "summary": "List launch sites",
        "parameters": [
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" }
        ],
        "responses": {
          "200": { "description": "Site list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LaunchSiteList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launch-sites/{id}": {
      "get": {
        "tags": ["Launch Sites"],
        "summary": "Launch site detail",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "200": { "description": "Site detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LaunchSite" } } } },
          "404": { "$ref": "#/components/responses/NotFound" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/launch-sites/{id}/pads": {
      "get": {
        "tags": ["Launch Sites"],
        "summary": "Pads at a launch site",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }, { "$ref": "#/components/parameters/Page" }, { "$ref": "#/components/parameters/Limit" }],
        "responses": {
          "200": { "description": "Pad list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LaunchPadList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/mission-types": {
      "get": {
        "tags": ["Mission Types"],
        "summary": "List mission types",
        "parameters": [{ "$ref": "#/components/parameters/Page" }, { "$ref": "#/components/parameters/Limit" }],
        "responses": {
          "200": { "description": "Mission type list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MissionTypeList" } } } },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/media-assets": {
      "get": {
        "tags": ["Media"],
        "summary": "List media assets (PRO+)",
        "parameters": [
          { "name": "entity_type", "in": "query", "schema": { "type": "string", "enum": ["mission","rocket","launch_site"] } },
          { "name": "entity_id", "in": "query", "schema": { "type": "string" } },
          { "name": "asset_type", "in": "query", "schema": { "type": "string", "enum": ["image","video"] } },
          { "$ref": "#/components/parameters/Page" },
          { "$ref": "#/components/parameters/Limit" }
        ],
        "responses": {
          "200": { "description": "Media list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MediaAssetList" } } } },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": ["Webhooks"],
        "summary": "List outbound webhook subscriptions (PRO+)",
        "responses": {
          "200": { "description": "Webhook list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookList" } } } },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "429": { "$ref": "#/components/responses/QuotaExceeded" }
        }
      },
      "post": {
        "tags": ["Webhooks"],
        "summary": "Create a webhook subscription (PRO+)",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCreateRequest" } } }
        },
        "responses": {
          "201": { "description": "Webhook created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "422": { "$ref": "#/components/responses/ValidationError" }
        }
      }
    },
    "/webhooks/{id}": {
      "put": {
        "tags": ["Webhooks"],
        "summary": "Update a webhook subscription",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WebhookCreateRequest" } } }
        },
        "responses": {
          "200": { "description": "Webhook updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Webhook" } } } },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Webhooks"],
        "summary": "Delete a webhook subscription",
        "parameters": [{ "$ref": "#/components/parameters/ResourceId" }],
        "responses": {
          "204": { "description": "Deleted" },
          "403": { "$ref": "#/components/responses/Forbidden" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Use `Authorization: Bearer YOUR_API_KEY`. API keys are managed in the developer dashboard."
      }
    },
    "parameters": {
      "ResourceId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": { "type": "string" },
        "description": "Resource identifier (bigint serialized as string or slug)."
      },
      "Page": {
        "name": "page",
        "in": "query",
        "schema": { "type": "integer", "default": 1, "minimum": 1 },
        "description": "Page number, 1-based."
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": { "type": "integer", "default": 20, "minimum": 1, "maximum": 100 },
        "description": "Items per page."
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "schema": { "type": "string", "example": "scheduled_time:desc" },
        "description": "Sort by `field:asc|desc`. Only whitelisted fields per endpoint."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": { "type": "string" },
              "message": { "type": "string" }
            }
          }
        }
      },
      "SignupRequest": {
        "type": "object",
        "required": ["username", "password"],
        "properties": {
          "username": { "type": "string", "minLength": 3, "maxLength": 32 },
          "password": { "type": "string", "minLength": 8, "maxLength": 128 }
        }
      },
      "LoginRequest": {
        "type": "object",
        "required": ["username", "password"],
        "properties": {
          "username": { "type": "string" },
          "password": { "type": "string" }
        }
      },
      "DeveloperProfile": {
        "type": "object",
        "properties": {
          "developer_id": { "type": "string" },
          "username": { "type": "string" },
          "plan": { "type": "string", "enum": ["FREE","EDUCATIONAL","DEVELOPER","PRO","BUSINESS","ENTERPRISE"] }
        }
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "required": ["name"],
        "properties": { "name": { "type": "string", "maxLength": 40 } }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "key_prefix": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "ApiKeyList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKey" } } }
      },
      "ApiKeyCreated": {
        "allOf": [
          { "$ref": "#/components/schemas/ApiKey" },
          { "type": "object", "properties": { "api_key": { "type": "string", "description": "Plaintext key. Shown once." } } }
        ]
      },
      "UsageOverview": {
        "type": "object",
        "properties": {
          "monthly_quota": { "type": "integer" },
          "used": { "type": "integer" },
          "remaining": { "type": "integer" },
          "rate_limit_per_min": { "type": "integer" },
          "commercial_use": { "type": "boolean" }
        }
      },
      "DailyUsage": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "requests": { "type": "integer" },
          "quota_consumed": { "type": "integer" }
        }
      },
      "DailyUsageList": {
        "type": "object",
        "properties": {
          "data": { "type": "array", "items": { "$ref": "#/components/schemas/DailyUsage" } },
          "pagination": { "$ref": "#/components/schemas/Pagination" }
        }
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "plan": { "type": "string" },
          "status": { "type": "string", "enum": ["ACTIVE","PAST_DUE","CANCELLED","EXPIRED"] },
          "current_period_end": { "type": "string", "format": "date-time" },
          "quota_remaining": { "type": "integer" }
        }
      },
      "SubscriptionList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Subscription" } } }
      },
      "ChangeSubscriptionRequest": {
        "type": "object",
        "required": ["plan_code"],
        "properties": { "plan_code": { "type": "string" } }
      },
      "CheckoutRequest": {
        "type": "object",
        "required": ["plan_code"],
        "properties": {
          "plan_code": { "type": "string", "enum": ["DEVELOPER","PRO","BUSINESS"] },
          "provider": { "type": "string", "enum": ["stripe","antom"], "default": "stripe" }
        }
      },
      "CheckoutSession": {
        "type": "object",
        "properties": {
          "session_id": { "type": "string" },
          "checkout_url": { "type": "string", "format": "uri" }
        }
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string", "enum": ["PAID","OPEN","VOID"] },
          "issued_at": { "type": "string", "format": "date-time" },
          "pdf_url": { "type": "string", "format": "uri", "nullable": true }
        }
      },
      "InvoiceList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Invoice" } } }
      },
      "PaymentMethodList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "type": "object" } } }
      },
      "PlaygroundToken": {
        "type": "object",
        "properties": {
          "token": { "type": "string" },
          "expires_at": { "type": "string", "format": "date-time" }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": { "type": "integer" },
          "limit": { "type": "integer" },
          "total": { "type": "integer", "nullable": true },
          "total_pages": { "type": "integer", "nullable": true }
        }
      },
      "MissionRef": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "family": { "type": "string", "nullable": true }
        }
      },
      "SiteRef": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "country": { "type": "string", "nullable": true }
        }
      },
      "PadRef": {
        "type": "object",
        "properties": { "id": { "type": "string" }, "name": { "type": "string" } }
      },
      "MissionTypeRef": {
        "type": "object",
        "properties": { "id": { "type": "string" }, "name": { "type": "string" } }
      },
      "Mission": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "slug": { "type": "string" },
          "external_id": { "type": "string", "nullable": true },
          "mission_name": { "type": "string" },
          "description": { "type": "string", "nullable": true },
          "launch_site_id": { "type": "string", "nullable": true },
          "launch_pad_id": { "type": "string", "nullable": true },
          "rocket_id": { "type": "string", "nullable": true },
          "mission_type_id": { "type": "string", "nullable": true },
          "operator": { "type": "string", "nullable": true },
          "payload": { "type": "string", "nullable": true },
          "payload_mass": { "type": "number", "nullable": true },
          "orbit": { "type": "string", "nullable": true },
          "scheduled_time": { "type": "string", "format": "date-time", "nullable": true },
          "actual_launch_time": { "type": "string", "format": "date-time", "nullable": true },
          "status": { "type": "string" },
          "status_reason": { "type": "string", "nullable": true },
          "source_updated_at": { "type": "string", "format": "date-time", "nullable": true },
          "experience_available": { "type": "boolean" }
        }
      },
      "MissionDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/Mission" },
          { "type": "object", "properties": {
            "rocket": { "$ref": "#/components/schemas/MissionRef" },
            "launch_site": { "$ref": "#/components/schemas/SiteRef" },
            "launch_pad": { "$ref": "#/components/schemas/PadRef" },
            "mission_type": { "$ref": "#/components/schemas/MissionTypeRef" }
          }}
        ]
      },
      "MissionList": {
        "type": "object",
        "properties": {
          "data": { "type": "array", "items": { "$ref": "#/components/schemas/Mission" } },
          "pagination": { "$ref": "#/components/schemas/Pagination" }
        }
      },
      "Rocket": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "slug": { "type": "string" },
          "name": { "type": "string" },
          "family": { "type": "string", "nullable": true },
          "variant": { "type": "string", "nullable": true },
          "manufacturer": { "type": "string", "nullable": true },
          "operator": { "type": "string", "nullable": true },
          "country": { "type": "string", "nullable": true },
          "description": { "type": "string", "nullable": true },
          "height": { "type": "number", "nullable": true },
          "diameter": { "type": "number", "nullable": true },
          "mass": { "type": "number", "nullable": true },
          "stages": { "type": "integer", "nullable": true },
          "status": { "type": "string", "enum": ["ACTIVE","INACTIVE"] }
        }
      },
      "RocketList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Rocket" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }
      },
      "LaunchSite": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "slug": { "type": "string" },
          "name": { "type": "string" },
          "country": { "type": "string", "nullable": true },
          "region": { "type": "string", "nullable": true },
          "latitude": { "type": "number", "nullable": true },
          "longitude": { "type": "number", "nullable": true },
          "description": { "type": "string", "nullable": true },
          "status": { "type": "string", "enum": ["ACTIVE","INACTIVE"] },
          "website": { "type": "string", "format": "uri", "nullable": true }
        }
      },
      "LaunchSiteList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/LaunchSite" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }
      },
      "LaunchPad": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "slug": { "type": "string" },
          "launch_site_id": { "type": "string" },
          "name": { "type": "string" },
          "identifier": { "type": "string", "nullable": true },
          "latitude": { "type": "number", "nullable": true },
          "longitude": { "type": "number", "nullable": true },
          "status": { "type": "string", "enum": ["ACTIVE","INACTIVE"] }
        }
      },
      "LaunchPadList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/LaunchPad" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }
      },
      "MissionType": {
        "type": "object",
        "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string", "nullable": true } }
      },
      "MissionTypeList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/MissionType" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }
      },
      "MediaAsset": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "entity_type": { "type": "string" },
          "entity_id": { "type": "string" },
          "asset_type": { "type": "string", "enum": ["image","video"] },
          "storage_key": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "width": { "type": "integer", "nullable": true },
          "height": { "type": "integer", "nullable": true },
          "mime_type": { "type": "string", "nullable": true },
          "copyright": { "type": "string", "nullable": true }
        }
      },
      "MediaAssetList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/MediaAsset" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }
      },
      "WebhookCreateRequest": {
        "type": "object",
        "required": ["endpoint", "event_types"],
        "properties": {
          "endpoint": { "type": "string", "format": "uri" },
          "event_types": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "endpoint": { "type": "string", "format": "uri" },
          "event_types": { "type": "array", "items": { "type": "string" } },
          "status": { "type": "string", "enum": ["ACTIVE","PENDING_VERIFY"] },
          "webhook_secret": { "type": "string", "description": "Returned once on creation." }
        }
      },
      "WebhookList": {
        "type": "object",
        "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Webhook" } } }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid credentials.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Forbidden": {
        "description": "Plan does not include this feature.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "NotFound": {
        "description": "Resource not found.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "Conflict": {
        "description": "State conflict or duplicate.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "ValidationError": {
        "description": "Invalid request body or parameters.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "QuotaExceeded": {
        "description": "Monthly quota exceeded.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      },
      "RateLimited": {
        "description": "Rate limit or concurrency exceeded.",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
      }
    }
  }
}
