---
title: Call the REST API
description: Get an API key, make your first request, and handle errors and limits.
---

The REST API serves the same features as the MCP server, for your own software: ask Iven, look up models, manuals and parts, and read and triage jobs. Every request goes to:

```text
https://api.aiventic.ai/v1
```

## Get an API key

A team owner creates keys in Aiventic under **Settings** > **Developer settings** with **Create key**, and picks the [scopes](/developer-docs/authentication#scopes) each key holds. Give a key only the scopes your software needs.

Send the key as a bearer token on every request:

```http
Authorization: Bearer aiv_sk_...
```

Keep keys on your server. A key in a browser or a mobile app can be read by anyone who has the app.

For the reference's "Try it" panel, use a short-lived test key with only the scopes you're testing, never one holding `customers:contact` or `jobs:triage` unless that's what you're testing. Revoke it when you're done. The panel keeps the key only while the page is open and never saves it.

## Make your first request

Find a model by name. This needs the `models:read` scope.

**cURL**

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

**JavaScript**

```js
const response = await fetch("https://api.aiventic.ai/v1/model?q=WRF555SDFZ", {
  headers: { Authorization: `Bearer ${process.env.AIVENTIC_API_KEY}` },
});
const models = await response.json();
```

**Python**

```python
import os, requests

response = requests.get(
    "https://api.aiventic.ai/v1/model",
    params={"q": "WRF555SDFZ"},
    headers={"Authorization": f"Bearer {os.environ['AIVENTIC_API_KEY']}"},
)
models = response.json()
```

## Ask Iven

`POST /v1/ask` asks Iven a question and returns the answer with its citations. It needs the `chat` scope. Name the brand and model when you know them:

```bash
curl https://api.aiventic.ai/v1/ask \
  -H "Authorization: Bearer $AIVENTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"brand": "Whirlpool", "model": "WRF555SDFZ", "content": "E4 error on the display"}'
```

- To continue the conversation, send the `chatId` from the answer with your next question.
- Set `"stream": true` to get the answer as server-sent events while Iven writes it.
- With an `Idempotency-Key`, a retry after a dropped connection gets the stored answer instead of asking twice.

## Errors and limits

- Errors are `application/problem+json` documents with a `type` you can branch on.
- A missing, revoked or expired key gets `401`. A key without the scope an endpoint needs gets `403` with a `missing-scope` problem.
- A key that holds the scope while its member's role doesn't allow it gets `403` with a `role-not-permitted` problem. Adding the scope won't help; a team owner has to change the role.
- `POST /v1/ask` and `POST /v1/job/{jobId}/triage` take an `Idempotency-Key`. A retry while the first request with that key is still running gets `409` with an `idempotency-key-in-use` problem; retry once it has finished. The same key on a different request gets `422` with `idempotency-key-reused`.
- Too many requests get `429` with a `Retry-After` header in seconds. Wait that long before retrying.

## Next

**[Browse the endpoints](/developer-docs/rest/reference)**

Every `/v1` endpoint, its parameters and responses, with a "Try it" panel. The OpenAPI spec itself is at [`https://api.aiventic.ai/v1/openapi.json`](https://api.aiventic.ai/v1/openapi.json), for client generators and agents.

**[Authentication](/developer-docs/authentication)**

API keys, scopes, and how the MCP server signs users in.
