---
title: Authentication
description: Use an API key for the REST API. Use an API key or sign in with OAuth for the MCP server.
sidebar:
  order: 2
---

| | REST API (`/v1`) | MCP server (`/mcp`) |
|---|---|---|
| API key | Yes | Yes |
| Sign in with Aiventic (OAuth) | No | Yes |

## API keys

A team owner creates keys in Aiventic under **Settings** > **Developer settings** with **Create key**, and picks the scopes each key holds. Send the key as a bearer token:

```bash
curl "https://api.aiventic.ai/v1/model?q=WRF555SDFZ" \
  -H "Authorization: Bearer aiv_sk_..."
```

A missing, revoked or expired key gets `401`. A key without the scope an endpoint needs gets `403` with a `missing-scope` problem.

To try endpoints in the reference's "Try it" panel, use a short-lived test key with only the scopes you're testing. Don't paste a key that holds `customers:contact` or `jobs:triage` unless that's what you're testing, and revoke the key when you're done. The panel keeps the key only while the page is open and never saves it.

### Scopes

| Scope | Lets the key |
|---|---|
| `chat` | Ask Iven, and read back or delete the chats it created |
| `models:read` | Find models by name or serial number |
| `manuals:read` | Search manuals and open cited pages |
| `parts:read` | Search parts, read part details and live prices |
| `jobs:read` | List and read jobs, checklists and triage results |
| `jobs:triage` | Start a job's triage |
| `customers:contact` | Read job customers' contact details. API keys only |

- `jobs:triage` and `customers:contact` each need `jobs:read` on the same key.
- `chat` and the job scopes act as a team member, so the key must be bound to one. The job scopes also need a member whose role sees jobs.
- A key or connection that holds a scope its member's role doesn't allow gets `403` with a `role-not-permitted` problem. Adding the scope or reconnecting won't help: a team owner has to change the member's role. The scope works again once the role allows it.

## Sign in with OAuth (MCP only)

AI assistants connect to `https://api.aiventic.ai/mcp` and sign the user in with their Aiventic account. There is no client ID or secret to register: Aiventic reads the assistant's published client metadata. The user picks a team, reviews what the assistant may do, and approves.

An OAuth connection acts as that member and can do only what their role allows. A token sent to `/v1` is refused with `401`.

## Errors and limits

- Errors are `application/problem+json` documents with a `type` you can branch on.
- Too many requests get `429` with a `Retry-After` header in seconds.
- `POST /v1/ask` and `POST /v1/job/{jobId}/triage` take an `Idempotency-Key` header, so a retry after a dropped connection doesn't ask twice or start a second triage.
- A retry sent while the first request with that key is still running gets `409` with an `idempotency-key-in-use` problem. Retry once it has finished to get its response.
- The same key sent with a different request gets `422` with an `idempotency-key-reused` problem. Use a new key for a new request.
