Single Sign-On via Link (SSO)

CapData offers two Single Sign-On (SSO) endpoints to log into the web portal via a link. These endpoints are not for programmatic API consumption; they are intended for interactive user access (e.g., opening the panel from your own system with a single click).

Security: The key parameter contains your credential (API Key or Agent Token). Treat it like a password. Do not expose it in public HTML or on the frontend; preferably, perform a 302 redirect from your backend to keep the key hidden.

Available Endpoints

GET /auth/apikey-login?key=API_KEY

Logs in as a Client (Owner) or Agency using the account's API Key. If the account is active, a session is created, and the user is automatically redirected to the first accessible section (dashboard, calendar, AI chat, etc.) based on permissions.

Parameters

Example (direct link)

URL
https://capdata.es/auth/apikey-login?key=YOUR_API_KEY

Behavior

GET /auth/agent-apikey-login?key=AGENT_TOKEN

Logs in as an Agent (EmployeeToken) using their agent token. The session is associated with the client (Owner or Agency) to which the agent belongs and redirects to the agent's panel.

Parameters

Example (direct link)

URL
https://capdata.es/auth/agent-apikey-login?key=THE_AGENT_TOKEN

Behavior


Recommended Usage (Keeping the Key Hidden)

To avoid exposing the API Key or Token in the browser's HTML, perform the SSO from your backend: your server builds the SSO URL with the key stored on the server and issues a 302 redirect to the user.

Example in Node/Express

JavaScript (Node/Express)
app.get("/open-capdata", (req, res) => {
  // The API Key is read from environment variables or a secure backend store
  const API_KEY = process.env.CAPDATA_API_KEY;
  const url = `https://capdata.es/auth/apikey-login?key=${encodeURIComponent(API_KEY)}`;
  return res.redirect(302, url);
});

Example in Python/Flask

Python (Flask)
import os
from flask import Flask, redirect

app = Flask(__name__)

@app.get("/open-capdata")
def open_capdata():
    api_key = os.environ["CAPDATA_API_KEY"]
    url = f"https://capdata.es/auth/apikey-login?key={api_key}"
    return redirect(url, code=302)
Tip: If you want to offer "one-click" access from emails or your app, point those links to a route on your backend (like /open-capdata) and perform the redirect with the server-stored key there. This way, the credential never appears in the client's HTML.

Best Practices and Security


FAQ

Does the SSO link expire?

There is no automatic expiration: the link works as long as the API Key (or Agent Token) is valid and the account is active. If you rotate or deactivate the credential, existing links will stop working.

Does logging in via SSO consume tokens?

No. SSO only establishes the web session. Tokens are consumed when using services like AI Chat, extraction, or transcription.

Can I limit the scope (permissions) of the SSO?

No. The access will reflect the native permissions of the account or agent you are authenticating.

Is it valid for APIs?

No. To invoke APIs, use the authentication headers (e.g., X-CapData-Token). SSO is exclusively for logging into the web portal.