Skip to main content
Glama

get_twitterapi_auth

Set up authentication for TwitterAPI.io by providing API key usage, required headers, and code examples in cURL, Python, and JavaScript.

Instructions

Get TwitterAPI.io authentication guide: API key usage, headers, code examples.

USE THIS WHEN: You need to set up authentication or see request examples. RETURNS: API key header format, base URL, cURL/Python/JavaScript examples.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main execution logic for get_twitterapi_auth tool: resolves auth metadata, generates code examples (cURL/Python/JS), formats Markdown response with structured output.
        case "get_twitterapi_auth": {
          const auth = resolveAuthMeta(data.authentication);
    
          const examples = {
            curl: `curl -X GET "${auth.baseUrl}/twitter/user/info?userName=elonmusk" \\\n  -H "${auth.header}: YOUR_API_KEY"`,
            python:
              `import requests\n\nresponse = requests.get(\n    "${auth.baseUrl}/twitter/user/info",\n    params={"userName": "elonmusk"},\n    headers={"${auth.header}": "YOUR_API_KEY"}\n)\nprint(response.json())`,
            javascript:
              `const response = await fetch(\n  "${auth.baseUrl}/twitter/user/info?userName=elonmusk",\n  { headers: { "${auth.header}": "YOUR_API_KEY" } }\n);\nconst data = await response.json();`
          };
    
          const markdown = `# TwitterAPI.io Authentication
    
    ## API Key Usage
    All requests require the \`${auth.header}\` header.
    
    ## Base URL
    \`${auth.baseUrl}\`
    
    ## Getting Your API Key
    1. Go to ${auth.dashboardUrl}
    2. Sign up / Log in
    3. Copy your API key from the dashboard
    
    ## Request Examples
    
    ### cURL
    \`\`\`bash
    ${examples.curl}
    \`\`\`
    
    ### Python
    \`\`\`python
    ${examples.python}
    \`\`\`
    
    ### JavaScript
    \`\`\`javascript
    ${examples.javascript}
    \`\`\``;
    
          return formatToolSuccess(markdown, {
            header,
            base_url: baseUrl,
            dashboard_url: dashboardUrl,
            examples,
            markdown
          });
        }
  • Input/output schemas and description for the get_twitterapi_auth tool, defined in the listTools response.
          name: "get_twitterapi_auth",
          description: `Get TwitterAPI.io authentication guide: API key usage, headers, code examples.
    
    USE THIS WHEN: You need to set up authentication or see request examples.
    RETURNS: API key header format, base URL, cURL/Python/JavaScript examples.`,
          inputSchema: {
            type: "object",
            properties: {},
          },
          outputSchema: {
            type: "object",
            properties: {
              header: { type: "string" },
              base_url: { type: "string" },
              dashboard_url: { type: "string" },
              examples: {
                type: "object",
                properties: {
                  curl: { type: "string" },
                  python: { type: "string" },
                  javascript: { type: "string" }
                }
              },
              markdown: { type: "string" }
            },
            required: ["header", "base_url", "markdown"]
          }
        },
  • index.js:1306-1626 (registration)
    Tool registration via setRequestHandler for ListToolsRequestSchema, which dynamically lists all tools including get_twitterapi_auth.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      const docs = loadDocs();
      const availablePages = Object.keys(docs.pages || {}).sort();
    
      return {
        tools: [
        {
          name: "search_twitterapi_docs",
          description: `Search TwitterAPI.io documentation: API endpoints, guides (pricing, rate limits, filter rules), and blog posts.
    
    USE THIS WHEN: You need to find information across the entire documentation.
    RETURNS: Ranked results with endpoint paths, descriptions, and relevance scores.
    
    Examples:
    - "advanced search" → finds tweet search endpoints
    - "rate limit" → finds QPS limits and pricing info
    - "webhook" → finds webhook setup endpoints
    - "getUserInfo" → finds user info endpoints (supports camelCase)`,
          inputSchema: {
            type: "object",
            properties: {
              query: {
                type: "string",
                description: "Search query (1-500 chars). Use English keywords like: 'search', 'user', 'tweet', 'webhook', 'pricing', 'rate limit'. Supports camelCase and underscore formats.",
                minLength: 1,
                maxLength: 500
              },
              max_results: {
                type: "integer",
                description: "Number of results to return. Use higher values (15-20) for comprehensive research, lower values (3-5) for quick lookups.",
                minimum: 1,
                maximum: 20,
                default: 10
              }
            },
            required: ["query"],
          },
          outputSchema: {
            type: "object",
            properties: {
              query: { type: "string", description: "Normalized (trimmed) search query." },
              max_results: { type: "integer", description: "Applied max results (1-20)." },
              cached: { type: "boolean", description: "Whether this response was served from cache." },
    	          counts: {
    	            type: "object",
    	            properties: {
    	              total: { type: "integer" },
    	              endpoints: { type: "integer" },
    	              pages: { type: "integer" },
    	              blogs: { type: "integer" }
    	            }
    	          },
              results: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    type: { type: "string", enum: ["endpoint", "page", "blog"] },
                    name: { type: "string" },
                    title: { type: "string" },
                    description: { type: "string" },
                    url: { type: "string" },
                    category: { type: "string" },
                    method: { type: "string" },
                    path: { type: "string" },
                    next: {
                      type: "object",
                      description: "Suggested follow-up tool call for this result (helps chaining).",
                      properties: {
                        tool: { type: "string" },
                        arguments: { type: "object", additionalProperties: true }
                      },
                      required: ["tool", "arguments"]
                    },
                    score: { type: "number" }
                  },
                  required: ["type", "name", "score"]
                }
              },
              markdown: { type: "string", description: "Human-readable markdown rendering of the results." }
            },
            required: ["query", "max_results", "results", "markdown"]
          }
        },
        {
          name: "get_twitterapi_endpoint",
          description: `Get complete documentation for a specific TwitterAPI.io endpoint.
    
    USE THIS WHEN: You know the exact endpoint name (e.g., from search results).
    RETURNS: Full details including path, parameters, cURL example, and code snippets.
    
    Common endpoints:
    - get_user_info, get_user_followers, get_user_following
    - tweet_advanced_search, get_tweet_by_id
    - add_webhook_rule, get_webhook_rules`,
          inputSchema: {
            type: "object",
            properties: {
              endpoint_name: {
                type: "string",
                description: "Exact endpoint name (use underscores). Examples: 'get_user_info', 'tweet_advanced_search', 'add_webhook_rule'",
              },
            },
            required: ["endpoint_name"],
          },
          outputSchema: {
            type: "object",
            properties: {
              endpoint_name: { type: "string" },
              title: { type: "string" },
              method: { type: "string" },
              path: { type: "string" },
              full_url: { type: "string" },
              doc_url: { type: "string" },
              description: { type: "string" },
              parameters: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    name: { type: "string" },
                    required: { type: "boolean" },
                    description: { type: "string" }
                  },
                  required: ["name"]
                }
              },
              curl_example: { type: "string" },
              code_snippets: { type: "array", items: { type: "string" } },
              raw_text: { type: "string" },
              cached: { type: "boolean" },
              markdown: { type: "string" }
            },
            required: ["endpoint_name", "markdown"]
          }
        },
        {
          name: "list_twitterapi_endpoints",
          description: `List all TwitterAPI.io API endpoints organized by category.
    
    USE THIS WHEN: You need to browse available endpoints or find endpoints by category.
    CATEGORIES: user, tweet, community, webhook, stream, action, dm, list, trend
    
    RETURNS: Endpoint names with HTTP method and path for each category.`,
          inputSchema: {
            type: "object",
            properties: {
              category: {
                type: "string",
                description: "Optional filter: user, tweet, community, webhook, stream, action, dm, list, trend, other",
                enum: ["user", "tweet", "community", "webhook", "stream", "action", "dm", "list", "trend", "other"]
              },
            },
          },
          outputSchema: {
            type: "object",
            properties: {
              category: { type: ["string", "null"] },
              total: { type: "integer", description: "Number of endpoints returned (after optional category filter)." },
              total_all: { type: "integer", description: "Total endpoints in the snapshot (before filtering)." },
              endpoints: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    name: { type: "string" },
                    method: { type: "string" },
                    path: { type: "string" },
                    description: { type: "string" },
                    category: { type: "string" }
                  },
                  required: ["name", "category"]
                }
              },
              markdown: { type: "string" }
            },
            required: ["total", "endpoints", "markdown"]
          }
        },
        {
          name: "get_twitterapi_guide",
          description: `Get a TwitterAPI.io page from the offline snapshot by page key.
    
    USE THIS WHEN: You need the full content of a specific page (guides, docs, policies, contact, etc.).
    TIP: Use search_twitterapi_docs if you don't know the page key.
    
    RETURNS: Full guide content with headers, paragraphs, and code examples.`,
          inputSchema: {
            type: "object",
            properties: {
              guide_name: {
                type: "string",
                description: "Page key (from data/pages). Examples: pricing, qps_limits, privacy, contact, introduction, authentication.",
                enum: availablePages
              },
            },
            required: ["guide_name"],
          },
          outputSchema: {
            type: "object",
            properties: {
              guide_name: { type: "string" },
              title: { type: "string" },
              url: { type: "string" },
              description: { type: "string" },
              headers: {
                type: "array",
                items: {
                  type: "object",
                  properties: {
                    level: { type: "integer" },
                    text: { type: "string" }
                  },
                  required: ["level", "text"]
                }
              },
              paragraphs: { type: "array", items: { type: "string" } },
              list_items: { type: "array", items: { type: "string" } },
              code_snippets: { type: "array", items: { type: "string" } },
              raw_text: { type: "string" },
              markdown: { type: "string" }
            },
            required: ["guide_name", "markdown"]
          }
        },
        {
          name: "get_twitterapi_url",
          description: `Fetch a TwitterAPI.io or docs.twitterapi.io URL.
    
    USE THIS WHEN: You have a specific link and want its full content.
    RETURNS: Parsed content from the offline snapshot. If not found, you can set fetch_live=true (restricted to twitterapi.io/docs.twitterapi.io).`,
          inputSchema: {
            type: "object",
            properties: {
              url: {
                type: "string",
                description: "URL to fetch. Examples: https://twitterapi.io/privacy, /pricing, docs.twitterapi.io/introduction"
              },
              fetch_live: {
                type: "boolean",
                description: "If true and the URL is missing from the offline snapshot, fetch it live over HTTPS (allowed hosts only).",
                default: false
              }
            },
            required: ["url"]
          },
          outputSchema: {
            type: "object",
            properties: {
              url: { type: "string" },
              source: { type: "string", enum: ["snapshot", "live"] },
              kind: { type: "string", enum: ["endpoint", "page", "blog"] },
              name: { type: "string" },
              title: { type: "string" },
              description: { type: "string" },
              markdown: { type: "string" }
            },
            required: ["url", "source", "kind", "name", "markdown"]
          }
        },
        {
          name: "get_twitterapi_pricing",
          description: `Get TwitterAPI.io pricing information: credit system, endpoint costs, QPS limits.
    
    USE THIS WHEN: You need to know API costs, credit calculations, or rate limits.
    RETURNS: Pricing tiers, credit costs per endpoint, QPS limits by balance level.`,
          inputSchema: {
            type: "object",
            properties: {},
          },
          outputSchema: {
            type: "object",
            properties: {
              credits_per_usd: { type: "number" },
              minimum_charge: { type: "string" },
              costs: { type: "object", additionalProperties: { type: "string" } },
              qps_limits: {
                type: "object",
                properties: {
                  free: { type: "string" },
                  paid: { type: "object", additionalProperties: { type: "string" } }
                }
              },
              notes: { type: "array", items: { type: "string" } },
              markdown: { type: "string" }
            },
            required: ["markdown"]
          }
        },
        {
          name: "get_twitterapi_auth",
          description: `Get TwitterAPI.io authentication guide: API key usage, headers, code examples.
    
    USE THIS WHEN: You need to set up authentication or see request examples.
    RETURNS: API key header format, base URL, cURL/Python/JavaScript examples.`,
          inputSchema: {
            type: "object",
            properties: {},
          },
          outputSchema: {
            type: "object",
            properties: {
              header: { type: "string" },
              base_url: { type: "string" },
              dashboard_url: { type: "string" },
              examples: {
                type: "object",
                properties: {
                  curl: { type: "string" },
                  python: { type: "string" },
                  javascript: { type: "string" }
                }
              },
              markdown: { type: "string" }
            },
            required: ["header", "base_url", "markdown"]
          }
        },
        ],
      };
    });
  • Helper function resolveAuthMeta used by the handler to get default authentication metadata from loaded docs.
    function resolveAuthMeta(authMeta) {
      const meta = authMeta || {};
      return {
        header: meta.header || "x-api-key",
        headerValue: meta.header_value || "YOUR_API_KEY",
        baseUrl: meta.base_url || "https://api.twitterapi.io",
        dashboardUrl: meta.dashboard_url || "https://twitterapi.io/dashboard",
      };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dorukardahan/twitterapi-io-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server