mta-js client.
Get an API key
- Sign in at mtaapi.dev.
- Choose a paid plan from the Billing tab. API keys require an active paid plan.
- Open API keys and create a key.
Prefer to self-host and call MTA feeds directly? See Direct MTA feeds on the Quick Start page. The rest of this page assumes you’re using the hosted mtaapi.dev API.
Manage keys from an agent
MCP account tools can create, list, and revoke your API keys after you sign in with Clerk OAuth. The tools arecreate_api_key, list_api_keys, and revoke_api_key. See MCP server for connection and authentication instructions.
Store your key safely
Add your key to a.env file at the root of your project:
.env
.env is listed in your .gitignore:
.gitignore
Send your key
mta-js
Pass your API key to theMTA constructor as apiKey. The SDK routes requests to https://www.mtaapi.dev/api/v1 automatically and sends both x-api-key and Authorization: Bearer <key> headers for you.
REST API
Protected endpoints accept eitherx-api-key: <key> or Authorization: Bearer <key>. The
mta-js client sends both headers automatically. REST requests use the
https://www.mtaapi.dev/api/v1 base URL.
MCP clients must use Authorization: Bearer <key>; the x-api-key header is not accepted by
the MCP endpoint.
MCP server
The MCP endpoint ishttps://www.mtaapi.dev/mcp. It requires Authorization: Bearer <key>; the x-api-key header is not accepted by this endpoint. See MCP server for client configuration.
Rotate or revoke a key
To rotate a key without interrupting requests:- Create a new key in the dashboard.
- Deploy the new secret to every environment that uses it.
- Confirm requests succeed with the new key, then revoke the old key from the dashboard.
Authentication and quota errors
The API returns the following status codes and messages:
Check that
MTA_API_KEY is set without printing the secret. If you rotated a key, update it in every environment where it is used before revoking the previous key.