> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vensight.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> One key, sent as a bearer token.

## Creating a key

A workspace administrator creates keys in Vensight under **Settings → Developers**. Give
the key a name that says what will use it — `Warehouse loader`, `GRC sync` — because that
name is all you will have to tell four keys apart later.

> [!WARNING]
>
> **The key is shown once.** Vensight stores only a hash of it, so it genuinely cannot be
> read back — not by you, not by support. If you lose it, revoke it and create another.

## Sending it

```bash theme={null}
curl https://app.vensight.ai/api/v1/contracts \
  -H "Authorization: Bearer vsk_live_your_key_here"
```

`X-Api-Key: vsk_live_…` is accepted as an alternative, for loaders and connectors that
cannot set an `Authorization` header.

> [!WARNING]
>
> **Send one or the other, and get it right.** If an `Authorization` header is present but
> malformed — `Bearer` misspelled, the word missing, or extra text after the key — the request is refused
> rather than falling back to `X-Api-Key`. That is deliberate, so a typo surfaces as a
> typo instead of a confusing refusal from a different cause; but it does mean a stray
> `Authorization` header added by a proxy will mask a perfectly good `X-Api-Key`.

**A key in the query string is never accepted.** Query strings are recorded by proxies,
load balancers and access logs — including Vensight's own — and a credential that reaches
a log has to be rotated.

## What a key can do

| | |
| - | - |
| **Reads** | Every collection, for the whole workspace. |
| **Writes** | None. |
| **Scope** | The whole workspace. There are no narrower keys yet. |
| **Test mode** | None. Every key reads your real workspace data; there are no test keys or sandbox yet. Since keys cannot write, a key cannot change anything while you build against it. |

## Revoking

Revoke a key in the same place you created it. It stops working immediately, and the
record of what it did is kept — revoking does not erase the access log.

## When a key is refused

| Status | Code | Meaning |
| - | - | - |
| `401` | `missing_credential` | No key was sent, or the `Authorization` header was not in the form `Bearer <key>`. |
| `401` | `invalid_credential` | The key is unknown **or** it has been revoked. Both give the same answer, so a guess is never confirmed. |

Both carry `WWW-Authenticate: Bearer realm="Vensight API"`.

If you have just rotated a key and are seeing `invalid_credential`, the old one is almost
certainly still in your environment — the two failures are indistinguishable by design.

The complete list of codes the API returns, and which are worth retrying, is on
[Errors](https://docs.vensight.ai/errors.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.