DocsGet startedAuthentication

Authentication

API keys, Cognito tokens, and when you need both.

Index One uses two independent credentials. An API key identifies your team to the gateway. A Cognito id token identifies you as a user. They are not alternatives — most authenticated endpoints want both headers on the same request, and a request carrying only one of them is rejected.

The split is historical rather than principled: the gateway enforces the key and the usage plan, while the Lambda handlers behind it read the token to work out who you are and which team's data you may touch.

The two credentials

HeaderValueIssued byWhat it proves
x-api-keyTeam API keyConsole → Team → API Keys, or POST /teams/{id}/keysWhich team is calling, and which usage plan throttles it
AuthorizationRaw Cognito id tokenPOST /signinWhich user is calling

No `Bearer ` prefix

The Authorization header takes the id token raw. Sending Authorization: Bearer eyJ… — the habit every other API trains — returns a 401. The one exception is the MCP server, which does accept Authorization: Bearer <api key>.

Getting an API key

  1. 1

    Open Team → API Keys

    Keys belong to a team, not to a user. Any member of the team can mint one at API keys.

  2. 2

    Create the key

    The value is shown in full at creation and again in the list. Keys carry a date-only created_at (YYYY-MM-DD), not a timestamp.

  3. 3

    Store it as a secret

    A key is a bearer credential for the whole team. Anyone holding it can read and write your team's indices within the limits of the endpoints that accept key-only auth.

Key values are readable after creation

GET /teams/{id}/keys returns key values in plaintext, so the console's key list is as sensitive as the keys themselves. Treat access to it as equivalent to handing out every key, and do not screenshot or paste that page into a ticket.

Getting an API key without the console

A script or an agent can create an account and its team's first key over the API, with no browser. None of these calls takes an x-api-key. A person is needed once: the account's email address receives a six-digit confirmation code, and someone has to read it.

  1. 1

    Sign up

    POST /signup with username (the email address) and password (at least 8 characters, with an upper-case letter, a lower-case letter, a number and a symbol). The account is created unconfirmed and the code is emailed. {"status": "unconfirmed"} means the address already had an unconfirmed account: a new code was sent.

  2. 2

    Confirm

    POST /signup/confirm with username and confirmation_code. This is when the account gets its team: the one that invited the address, or a new one it admins. Codes last 24 hours; POST /signup/resend sends a new one.

  3. 3

    Sign in

    POST /signin returns the id token and primary_team, the id of the account's team.

  4. 4

    Mint a key

    POST /teams/{primary_team}/keys with the id token alone in Authorization. The key is the response's value. The free plan allows one key; a plan at its limit answers 402.

API=https://api.indexone.io
curl -X POST "$API/signup" -H "Content-Type: application/json" \
-d '{"username": "you@example.com", "password": "YOUR_PASSWORD"}'
# with the code from the email
curl -X POST "$API/signup/confirm" -H "Content-Type: application/json" \
-d '{"username": "you@example.com", "confirmation_code": "482913"}'
SIGNIN=$(curl -s -X POST "$API/signin" -H "Content-Type: application/json" \
-d '{"username": "you@example.com", "password": "YOUR_PASSWORD"}')
curl -X POST "$API/teams/$(echo "$SIGNIN" | jq -r .primary_team)/keys" \
-H "Authorization: $(echo "$SIGNIN" | jq -r .id_token)"

Limits on signing up

A sign-up without the console's reCAPTCHA counts against its IP address: 5 an hour, after which POST /signup answers 429 with code: rate_limited. Disposable-email domains are refused with 422. Every sign-up error carries a code to branch on, such as UsernameExistsException (409: the address already has an account) or InvalidPasswordException (422).

Getting an id token

POST /signin exchanges a username and password for a token set, and needs no other credential. The response carries id_token, refresh_token, expires_in and primary_team, the id of the team the account acts as.

curl -X POST "https://api.indexone.io/signin" \
-H "Content-Type: application/json" \
-d '{"username": "you@example.com", "password": "YOUR_PASSWORD"}'

Sign-in failures carry a machine-readable code

A rejected sign-in carries the Cognito exception class as its code: 401 with NotAuthorizedException for a wrong password or an unknown address, 403 with UserNotConfirmedException for an account that was never confirmed (resend the code with POST /signup/resend and confirm it), and 429 with TooManyRequestsException when throttled. Branch on code rather than parsing the message. See Errors.

Making an authenticated call

Send both headers. This is the normal case for anything that touches team data.

curl "https://api.indexone.io/query?table=index-parameters&pk=idx_bh7fgXWJMaa3" \
-H "x-api-key: YOUR_API_KEY" \
-H "Authorization: YOUR_ID_TOKEN"

What each endpoint needs

EndpointsCredentials
GET /schemaNone — the operation catalog is public
POST /signup, POST /signup/confirm, POST /signup/resend, POST /signinNone — they make the account and issue the token
POST /refresh_token, POST /forgot_password, POST /forgot_password/confirmx-api-key
POST /execute, POST /simulate, POST /validate, GET /backtests/{backtest_id}x-api-key
POST /teams/{id}/keysAuthorization alone, so an account made over the API can mint its first key
GET /workflowsx-api-key alone lists the key's team; add Authorization to list another team you belong to
Most workflow, delivery, dataset, API-key and query endpointsBoth x-api-key and Authorization
https://mcp.indexone.iox-api-key, or Authorization: Bearer <key>, or Cognito OAuth 2.1; none for the catalog tools and public index reads

Some endpoints started requiring a key on 21 July 2026

POST /execute and POST /simulate previously accepted requests with no credentials at all. They now require a team API key. If you have an integration that called either without a key, it will get a 401 until you add one. Nothing else about the request or response changed.

Refreshing a token

Id tokens expire — expires_in on the sign-in response tells you when. Exchange the refresh token for a new set with POST /refresh_token.

curl -X POST "https://api.indexone.io/refresh_token" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"refresh_token": "YOUR_REFRESH_TOKEN"}'

A failed refresh returns 401

An expired or invalid refresh token returns 401 with {"error": …}. Treat it as "session over" and re-authenticate with POST /signin. A successful refresh returns 200 with a fresh id_token.

A missing or invalid key

API Gateway rejects a missing or invalid API key before your request reaches any handler, returning 401 with {"error": "Missing or invalid API key.", "code": "invalid_api_key"}. These gateway rejections carry CORS headers, so a browser fetch reads the status and body directly — the same 401 you would see from curl.

Rotation and hygiene

  • Use a separate key per deployment target so you can revoke one without taking everything down.
  • Rotate by creating the new key, deploying it, confirming traffic has moved, and only then deleting the old one — there is no grace period on a deleted key.
  • Keep keys out of front-end bundles. A key in browser JavaScript is a team credential handed to every visitor.
  • Throttling is per key, so a shared key means one noisy job can rate-limit everything else on it. See Rate limits & timeouts.
  • Store id tokens in memory rather than on disk; they are short-lived and refreshable.