ETLMCPData Conveyance Works
Log in Start free
Docs

Authenticating to the etlmcp API

How to send an API key or OAuth access token to the etlmcp API, where never to put it, and what the 400, 401 and 403 answers mean.

To authenticate to the etlmcp API, under https://app.etlmcp.com/api/v1, send one credential in the Authorization header with the Bearer scheme: Authorization: Bearer <credential>. The credential is either an API key, which starts with etk_, or an OAuth access token, which starts with eto_. Put it in the header and nowhere else: a credential in the URL gets a 400, and a missing or wrong one gets a 401.

Sending the header

Read the key from an environment variable rather than writing it into your script:

curl -H "Authorization: Bearer $ETLMCP_API_KEY" \
  https://app.etlmcp.com/api/v1/pipelines

The scheme must be Bearer, in any letter case, followed by a space and the credential. A value with a space inside the credential, or with nothing after the scheme, is not read as a Bearer header and fails with a 401.

The prefix decides how etlmcp looks the credential up: an etk_ value as an API key, an eto_ value as an OAuth access token. You create API keys on the API page of the app; see API keys. An MCP client or another app receives an OAuth access token when you connect it through OAuth.

Never put a credential in the URL

If the query string has a parameter named api_key, access_token or token, etlmcp answers 400 with send credentials in the Authorization header, never in the URL. It checks this before it reads any header, so the request fails even when a valid header is present too. Move the value into the header and drop the parameter.

RFC 6750, the OAuth standard for Bearer tokens, gives the reason: URLs end up in poorly protected places such as browser history and server logs, where a token can be stolen. Treat a key that has travelled in a URL as exposed: revoke it and create a new one.

When the credential is missing or wrong

A request with no usable credential gets a 401 with the body {"error": "invalid or missing credentials"}. That covers a key or token that is unknown, revoked or expired, a header that is not a well-formed Bearer header, and a request with no header and no signed-in browser session. An API key also stops working when its creator no longer reaches its workspace; API keys lists the cases.

Every 401 carries a WWW-Authenticate header with the Bearer scheme, the realm etlmcp, the scopes read and run, and a pointer to etlmcp's protected-resource metadata, which an OAuth client uses to find where to sign in. When you sent a well-formed Bearer header that etlmcp rejected, the challenge adds error="invalid_token". RFC 6750 uses that value to tell the client it may get a new token and retry: an OAuth client should refresh, and a script should check that its key is still active.

Header or browser session

When a request has an Authorization header, etlmcp uses it and ignores the browser's session cookie. A valid session never rescues a bad header: the request gets a 401.

With no header, etlmcp falls back to the signed-in session and applies the app's rules. Reads (GET, HEAD, OPTIONS) need only the cookie. Writes, such as starting a run, also need the session's CSRF token in the X-CSRF-Token header; without it they get a 403 with invalid csrf token. Bearer requests never need a CSRF token, so give scripts and scheduled jobs a key.

One workspace per credential

A key or token acts in the one workspace it was made for. Every list, run and data request answers from that workspace only, and an object in another workspace is answered as if it did not exist. To work in several workspaces, create a key in each. A browser session acts in the workspace currently selected in the app.

Scopes and rate limit

Every API key has the read scope and may also have run. Only Start a run checks a scope: it needs run, and a credential without it gets a 403 with this credential cannot start runs. A signed-in session gets both scopes once the user's email is verified, and only read before that.

Each credential may make 120 requests a minute, REST and MCP counted together; API status codes explains the 429 that follows. The API reference lists the scope of every operation, and the OpenAPI document declares the same Bearer scheme for client generators.

Related

Sources

  1. RFC 6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage — www.rfc-editor.org, checked