{
  "openapi": "3.0.3",
  "info": {
    "title": "TwitterAPI Unified API",
    "version": "1.0.0",
    "description": "Unified OpenAPI 3.0 specification for TwitterAPI endpoints."
  },
  "servers": [
    {
      "url": "https://api.aisa.one/apis/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Trend": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "target": {
            "type": "object",
            "properties": {
              "query": {
                "type": "string"
              }
            }
          },
          "rank": {
            "type": "integer",
            "format": "int64"
          },
          "meta_description": {
            "type": "string"
          }
        }
      },
      "TrendsResponse": {
        "type": "object",
        "properties": {
          "trends": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Trend"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ]
          },
          "msg": {
            "type": "string"
          }
        }
      },
      "SpaceDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "scheduled_start": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "media_key": {
            "type": "string"
          },
          "is_subscribed": {
            "type": "boolean"
          },
          "settings": {
            "type": "object",
            "properties": {
              "conversation_controls": {
                "type": "integer"
              },
              "disallow_join": {
                "type": "boolean"
              },
              "is_employee_only": {
                "type": "boolean"
              },
              "is_locked": {
                "type": "boolean"
              },
              "is_muted": {
                "type": "boolean"
              },
              "is_space_available_for_clipping": {
                "type": "boolean"
              },
              "is_space_available_for_replay": {
                "type": "boolean"
              },
              "no_incognito": {
                "type": "boolean"
              },
              "narrow_cast_space_type": {
                "type": "integer"
              },
              "max_guest_sessions": {
                "type": "integer"
              },
              "max_admin_capacity": {
                "type": "integer"
              }
            }
          },
          "stats": {
            "type": "object",
            "properties": {
              "total_replay_watched": {
                "type": "integer"
              },
              "total_live_listeners": {
                "type": "integer"
              },
              "total_participants": {
                "type": "integer"
              }
            }
          },
          "creator": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "userName": {
                "type": "string"
              },
              "location": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "protected": {
                "type": "boolean"
              },
              "isVerified": {
                "type": "boolean"
              },
              "isBlueVerified": {
                "type": "boolean"
              },
              "verifiedType": {
                "type": "string"
              },
              "followers": {
                "type": "integer"
              },
              "following": {
                "type": "integer"
              },
              "favouritesCount": {
                "type": "integer"
              },
              "statusesCount": {
                "type": "integer"
              },
              "mediaCount": {
                "type": "integer"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "coverPicture": {
                "type": "string"
              },
              "profilePicture": {
                "type": "string"
              },
              "canDm": {
                "type": "boolean"
              },
              "affiliatesHighlightedLabel": {
                "type": "object"
              },
              "isAutomated": {
                "type": "boolean"
              },
              "automatedBy": {
                "type": "string"
              }
            }
          }
        }
      },
      "SpaceDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/SpaceDetail"
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ]
          },
          "msg": {
            "type": "string"
          }
        }
      },
      "MyInfoResponse": {
        "type": "object",
        "properties": {
          "recharge_credits": {
            "type": "integer"
          }
        }
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/twitter/trends": {
      "get": {
        "x-aisa-pricing": {
          "model": "dynamic",
          "currency": "USD",
          "basis": "provider_cost x 1",
          "nominal_usd": 0.0022,
          "observed_usd": {
            "min": 0.00015,
            "p50": 0.0022,
            "p95": 0.0022,
            "max": 0.0022
          },
          "cost_drivers": [
            {
              "param": "result count",
              "effect": "charge scales with number of tweets/users returned"
            }
          ],
          "cost_tier": "variable",
          "note": "nominal_usd is a static reference, NOT a guaranteed minimum; actual charge = provider_cost x multiplier and can be higher or lower"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_trends"
        ],
        "summary": "Get Trends",
        "operationId": "get_twitter_trends",
        "description": "Get the trending topics for a location, identified by its Yahoo WOEID (Where On Earth ID), with an optional `count` (default 30). Use this for a real-time read on what a specific market is talking about right now — useful for timing content or spotting emerging stories. Returns trend names and volumes under `trends`. Once you pick a trend, search its posts with `get_twitter_tweet_advanced_search`.",
        "parameters": [
          {
            "name": "woeid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            },
            "description": "The WOEID of the location. Example: 2418046."
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": 30,
              "minimum": 30
            },
            "description": "The number of trends to return. Default is 30."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrendsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/twitter/spaces/detail": {
      "get": {
        "x-aisa-pricing": {
          "model": "per_request",
          "currency": "USD",
          "price_usd": 0.0022,
          "cost_tier": "low"
        },
        "tags": [
          "https://docs.twitterapi.io/api-reference/endpoint/get_space_detail"
        ],
        "summary": "Get Space Detail",
        "operationId": "get_twitter_spaces_detail",
        "description": "Get details of an X Space (live audio room) by its space ID — title, state, host, participants, and scheduling. Use this to check whether a Space is scheduled, live, or ended, and who is hosting, before deciding to reference or attend it. Returns the object under `data`.",
        "parameters": [
          {
            "name": "space_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The ID of the space."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceDetailResponse"
                }
              }
            }
          }
        }
      }
    }
  }
}