Skip to main content

API Authentication

Twexapi uses Bearer token authentication to secure all API requests. Each request must include a valid API key in the Authorization header to access our endpoints.

Getting Your API Key

Follow these simple steps to obtain your API key:
  1. Sign in to your Twexapi Dashboard
  2. Your unique API key will be displayed prominently on the dashboard homepage
  3. Copy the key securely - you’ll need it for all API requests
Keep your API key secure and never expose it in client-side code or public repositories.

Using Your API Key

Include your API key in the Authorization header of every request using the Bearer token format: Required Header:

Authenticate with AI Coding Agents

Install the TwexAPI skill so Cursor, Claude Code, GitHub Copilot, ChatGPT, Cline, Windsurf, Codex, Gemini CLI, Continue, Roo Code, and other AI assistants know how to attach Bearer tokens correctly. Setup guides and CLI options are on the integrations hub.
Copy your API key from the dashboard, store it in an environment variable, and ask your agent to wire up Authorization: Bearer YOUR_API_KEY — the skill covers the auth pattern across cURL, Python, JavaScript, and more.
In Cursor, GitHub Copilot, Claude Code, ChatGPT, Continue, Roo Code, or any supported agent, try prompts like “configure Twexapi auth from my .env file”, “add Bearer authentication to this API client”, or “generate a test request with my API key”.

Implementation Examples

Here are practical examples showing how to authenticate your requests across different programming languages:
Replace YOUR_API_KEY with your actual API key from the dashboard. All examples fetch user information for demonstration purposes.

cURL

Perfect for testing and quick API exploration:

Python

Using the popular requests library:

JavaScript (Node.js/Browser)

Modern fetch API implementation:

Java

Using Unirest for simplified HTTP requests:

Best Practices

  • Environment Variables: Store your API key in environment variables, never hardcode it
  • Error Handling: Always implement proper error handling for API responses
  • Rate Limiting: Respect API rate limits to avoid service interruptions
  • HTTPS Only: All requests must use HTTPS for security