MCP API Key Header: Move Your Key Out of the URL by November 30

Written for developers who connect AI assistants, agents, and checkout or landed-cost tools to the Tariffs API MCP server.
Short answer: if your MCP client sends its key in the URL as ?api_key=, move it to an Authorization: Bearer header (or an X-API-Key header) now. The query parameter is deprecated and its sunset date is Monday, November 30, 2026. After the sunset, a request that carries its key only in the URL is set to get a 401 instead of tariff data.
Header keys already work today on every MCP endpoint, so the switch is a one-line config change with no downtime and nothing to migrate on your account.
What changes on November 30, 2026
On October 31, 2026 we deprecated the api_key query parameter on all three MCP endpoints:
-
https://tariffsapi.com/api/v1/mcp: Streamable HTTP, the recommended transport -
https://tariffsapi.com/api/v1/mcp/sse: legacy SSE stream -
https://tariffsapi.com/api/v1/mcp/messages: legacy SSE messages
Until the sunset, a key in the URL still authenticates. To make sure nobody is caught out, every response to such a request, errors included, now carries four extra headers:
Header What it saysDeprecation
true
Sunset
Mon, 30 Nov 2026 00:00:00 GMT
Link
the changelog entry that announced the change, with rel="deprecation"
Warning
299 - "api_key query parameter is deprecated; use Authorization: Bearer"
The Sunset header gives the exact moment: the start of November 30 in GMT. For teams in the Americas that is still the evening of Sunday, November 29, local time, so the safe plan is to ship the change before the weekend. You can read the original notice on our changelog.
Why an API key in the URL is a security risk
A URL is not a good place for a secret. It is copied into places you do not control:
- Access and proxy logs. Common access log formats, including the defaults for nginx and Apache, record the full request line, query string and all. Every proxy, load balancer and logging pipeline between your client and us can end up storing the key.
-
Browser history and Referer headers. If a URL with a key is ever opened in a browser, it lands in history and can leak to other sites through the
Refererheader. - Config files, screenshots and chat messages. A server URL gets pasted far more freely than something labelled as a secret.
A header is not magic, but it keeps the key out of the request line, which is the part almost everything logs by default. That is the core of good API key security for MCP clients: treat the key as a credential, not as part of an address.

How to send your API key in a header
Both of these work on all three endpoints today.
Authorization: Bearer (recommended)
POST /api/v1/mcp HTTP/1.1
Host: tariffsapi.com
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
X-API-Key header
If your client or gateway already reserves the Authorization header for something else, use the X-API-Key header instead:
X-API-Key: YOUR_API_KEY
A header always wins over the query string. If a request sends both a header and ?api_key=, we use the header and ignore the URL key, so you can add the header first and remove the query parameter afterwards without a gap.
MCP server authentication in Claude Desktop, Cursor and Windsurf
These are the same configs as in the MCP setup guide. Replace YOUR_API_KEY with a key from your API keys dashboard, and delete any ?api_key= you had on the end of the URL.
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"tariffs-api": {
"url": "https://tariffsapi.com/api/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
Cursor (.cursor/mcp.json in the project root, or global settings) uses the same shape: a url plus a headers object with Authorization.
Windsurf (~/.codeium/windsurf/mcp_config.json) uses serverUrl instead of url, with the same headers object.
MCP Inspector, for a quick test from the terminal:
npx @modelcontextprotocol/inspector \
--url "https://tariffsapi.com/api/v1/mcp" \
--header "Authorization: Bearer YOUR_API_KEY"
If you built your own agent or checkout integration, look for wherever the MCP server URL is assembled and move the key from the URL into the request headers of your HTTP client.

How to check you are done
- Search your code, config and environment variables for
api_key=next totariffsapi.com/api/v1/mcp. - Send one request with the key in a header and look at the response headers:
curl -i -X POST "https://tariffsapi.com/api/v1/mcp" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{}}}'
If the response has no Deprecation or Sunset header, that client is already on a header key. If you still see them, some part of your setup is still sending the key in the URL.
Other MCP changes that shipped with the header switch
The same release tightened how the MCP tools answer, so results match the REST API more closely:
- GetByHtsTool now lists the same additional duties as resolve. When you pass an origin, its additional measures come from the same calculation the resolve endpoint uses, so duties that stack, such as Section 232 alongside Section 301, all appear. You may see more duties listed for a line than before, and a total built from them may be higher. Our Section 301 and Section 232 stacking guide walks through a real case.
-
Unknown HTS codes now fail clearly. ResolveTariffTool and GetByHtsTool return an error with the code
HTS_NOT_FOUNDfor a code we cannot identify, instead of a result. In BatchResolveTariffsTool a failing item returns its own error and the rest of the batch still resolves. -
Dates must be YYYY-MM-DD. The
as_ofparameter on the MCP tools accepts only that format; anything else fails withINVALID_DATErather than being guessed at. -
Tool results are JSON. Every tool result is JSON text, and a failed call sets
isError: true, so your agent can tell a failure from an answer without reading the text.
Using the tariff API and HTS API after the switch
Nothing else about the integration changes. The same five read-only tools answer on the same endpoints, and they return the same data as the REST tariff API. If you are building an AI assistant or agent on top of them, these guides go deeper:
- How your US import duty is built, step by step: the rate explanation that comes back with each answer.
- AI HTS classification: where a model helps and how to ground it in live tariff data.
- AI agents for logistics: a practical stack for importers that call tools like these.
You can also browse the HTS schedule and the Chapter 99 headings that the tools draw on, or read the full API documentation.
Frequently asked questions
Do I need a new API key?
No. Your existing key works in a header exactly as it did in the URL. If a key has ever been shared in a URL that may have been logged, it is still good practice to create a new one in your dashboard and revoke the old one.
What happens if I do nothing?
Until the sunset your client keeps working and every response carries the deprecation headers. After November 30, 2026, a request that sends its key only in the URL is set to be refused with a 401, so your assistant or integration would stop getting tariff answers.
Does the legacy SSE transport need the header too?
Yes. The deprecation covers the SSE stream and its messages endpoint as well. If you are touching the config anyway, it is a good moment to move to Streamable HTTP at https://tariffsapi.com/api/v1/mcp, which is the recommended transport for new integrations.