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

# Authentication and scopes

> Issue an API key with exactly the ontology access an integration needs

Every request carries an API key as a bearer token:

```bash theme={"languages":{}}
curl https://api.vectorshift.ai/v1/object-model/schema \
  -H "Authorization: Bearer $VECTORSHIFT_API_KEY"
```

A request runs as the person who created the key. It sees and changes only what that person can in the app, whatever scopes the key carries. Scopes narrow what a key may do. They never widen what its person may do.

## Create a scoped key

1. Open [API Keys](https://app.vectorshift.ai/account/api-keys). In the app, click the VectorShift logo in the top-left corner, click **Profile**, then the **API Keys** tab.
2. Click **+** and name the key.
3. Under **Object model access**, pick a preset or tick the scopes the integration needs. Choosing a preset ticks its scopes, and you can still change them afterward.
4. Under **Expires**, choose **Never**, **30 days**, **90 days** or **1 year**.

Copy the key when it is shown. The API Keys table shows each key's access, its expiry and when it was last used (to within ten minutes).

| Preset | Scopes |
| - | - |
| Read-only export | `records:read`, `facts:read`, `changes:read` |
| CRM sync | `records:read`, `records:write`, `changes:read`, `users:read` |
| Full integration | every scope except `model:configure`, `users:read` included |

Every ontology scope name begins with `object_model:`, as in `object_model:records:read`. The tables on this page leave the prefix out. `users:read` belongs to the platform rather than the ontology, so it has no prefix.

## Scopes

| Scope | In the app | What it allows |
| - | - | - |
| `object_model:records:read` | Read records | List, query and search records, and read a record's related records, activity and evidence. |
| `object_model:records:write` | Write records | Create, update and delete records, and run record write jobs. |
| `object_model:facts:read` | Read facts and figures | Read facts, and query and explain figures. |
| `object_model:facts:write` | Write facts | Record and withdraw facts, and create, rename and drop scenarios. |
| `object_model:actions:run` | Run actions | List and run the ontology's declared actions. |
| `object_model:changes:read` | Follow changes | Read the change feed, for the streams the key's read scopes cover. |
| `object_model:model:read` | Read the model | Read the ontology's definition, versions and diffs. |
| `object_model:model:configure` | Change the model | Create the ontology, configure it, upgrade or revert it, and work with drafts. |
| `users:read` | Look up people | Look up the organization's people by email or user id with [`GET /v1/users`](https://docs.vectorshift.ai/api-reference/users/lookup), to write and read person fields. It allows nothing else. |

Each endpoint page lists the scopes it needs. When it lists more than one entry, any one of them will do. A few routes combine scopes:

* **Discovery.** [`GET /`](https://docs.vectorshift.ai/ontology/schema/summary) and [`GET /schema`](https://docs.vectorshift.ai/ontology/schema/get) take any read scope (`records:read`, `facts:read` or `model:read`) or `actions:run`. They answer only the parts of the schema the key's scopes cover.
* **Actions and scenarios.** [`GET /actions`](https://docs.vectorshift.ai/ontology/actions/list) takes `actions:run` or `model:read`. [`GET /worlds`](https://docs.vectorshift.ai/ontology/scenarios/list) takes `facts:read` or `model:read`.
* **Decisions.** [`GET /decisions/{decision_id}`](https://docs.vectorshift.ai/ontology/actions/decision) takes `actions:run` or `model:configure`, and answers only the person who raised the decision and the people who may decide it.
* **Imports.** [Running an import](https://docs.vectorshift.ai/ontology/imports/run.md) needs both `records:write` and `facts:write`. [Its template](https://docs.vectorshift.ai/ontology/imports/template.md) takes either one.
* **The change feed** needs `changes:read` plus a read scope for each stream it reports. With `records:read` it reports record changes, and with `facts:read` it reports fact changes.
* **Figures over a record selection.** A [figure query](https://docs.vectorshift.ai/ontology/facts/figures-query.md) whose subjects are chosen by a record filter (`context.records`) also needs `records:read`. Choosing records by a filter, and learning how many match, is record access. With `facts:read` alone, name the subjects by id.

A key without a route's scope gets `403 scope_required`, and the message names the scope it needs.

## Keys without scopes

Keys created without scopes, including every key made before scopes existed, keep their access to the rest of the VectorShift API. They cannot use the ontology routes, which answer them with `403 scope_required`. They can still use the older [generic endpoint](https://docs.vectorshift.ai/ontology/overview.md#the-generic-endpoint), which marks every answer to them with a `Deprecation` header.

A scoped key works only under `/v1/object-model`, and at `GET /v1/users` when it has `users:read`. The rest of the VectorShift API refuses it, so a key you give an integration reaches nothing beyond the ontology and the people lookup.

## Expiry and revocation

An expired key gets `401 unauthenticated`. Deleting a key on the API Keys page revokes it at once.


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