# Quickstart

> Create an API key in the app and make your first API call.

This takes about five minutes. You need an OpexAIO account in a workspace with an Enterprise plan on at least one product (the API is an Enterprise feature), and a terminal with `curl` (and [`jq`](https://jqlang.org/) to read the answers more easily).

## 1. Create an API key

1. Sign in at [app.aio.opexcg.com](https://app.aio.opexcg.com).
2. In the sidebar, open **MCP**.
3. Choose **Create API key**, give it a label such as `Reporting script`, and choose **Create**.
4. Copy the key. It starts with `pk_live_` and is shown **only once**.

The key acts as you, in the workspace you were in when you created it. Treat it like a password: keep it out of source code and revoke it on the same page if it leaks.

## 2. Set two variables

```bash
export OPEX=https://app.aio.opexcg.com
export OPEX_API_KEY=pk_live_your_key_here
```

Every example in these docs uses them. To try things on staging first, use `https://staging.app.aio.opexcg.com` with a key created there.

## 3. Check who you are

```bash
curl -s "$OPEX/api/me" -H "X-API-Key: $OPEX_API_KEY" \
  | jq '{userId, role, tenantName, email, entitlements, permissions: (.permissions | length)}'
```

```json
{
  "userId": "usr-dewi-lestari",
  "role": "admin",
  "tenantName": "Nusantara Digital",
  "email": "dewi.lestari@example.com",
  "entitlements": ["timesheets", "helpdesk", "pmo", "crm", "expenses", "leave"],
  "permissions": 118
}
```

`entitlements` are the products your workspace can use, and `permissions` the actions your roles allow. [Authentication and permissions](/docs/authentication/) explains both.

## 4. Read some data

```bash
curl -s "$OPEX/api/projects?pageSize=2" -H "X-API-Key: $OPEX_API_KEY" \
  | jq '{total, page, pageSize, items: [.items[] | {id, name, status}]}'
```

```json
{
  "total": 21,
  "page": 1,
  "pageSize": 2,
  "items": [
    { "id": "prj-epicor", "name": "ABC Epicor ERP", "status": "active" },
    { "id": "prj-opexmx", "name": "ABC OPEXmx Portal", "status": "active" }
  ]
}
```

## 5. See what an error looks like

Without a key:

```bash
curl -s -w ' %{http_code}\n' "$OPEX/api/me"
```

```text
{"error":"unauthorized"} 401
```

Errors always carry a machine-readable code. [Conventions](/docs/conventions/#errors) lists how to handle them.

## Next

- Pick a [product guide](/docs/guides/helpdesk/) for a ready-made recipe.
- Browse the [API reference](/docs/reference/), or load [`/openapi.json`](/openapi.json) into Postman or Insomnia.
- Connect an AI assistant through [MCP](/docs/mcp/).
