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

# MEMO API Authentication: Bearer JWT & X-API-Key

> Authenticate the MEMO API with a Bearer JWT or X-API-Key. All business endpoints enforce per-workspace RBAC with roles owner / admin / contributor / viewer.

The MEMO API authenticates via request headers. The gateway accepts `Authorization: Bearer <jwt>` or `X-API-Key: <sk_aria_...>`, equivalently. Omitting both returns `401 Unauthorized`.

## Obtaining credentials

### Option A: Account + JWT

Register or log in to get a JWT:

```bash theme={null}
# Register (first time)
curl -X POST https://memo.ariacompute.com/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"<pwd>","display_name":"You"}'

# Login, returns token
curl -X POST https://memo.ariacompute.com/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"<pwd>"}'
```

Use the `token` from login as the Bearer for later calls:

```bash theme={null}
curl https://memo.ariacompute.com/v1/workspaces \
  -H "Authorization: Bearer <jwt>"
```

### Option B: API Key

After logging in with a JWT, create an API key (shown only once):

```bash theme={null}
curl -X POST https://memo.ariacompute.com/v1/apikeys \
  -H "Authorization: Bearer <jwt>"
```

Then call with the `X-API-Key` header — no JWT lifecycle to maintain:

```bash theme={null}
curl https://memo.ariacompute.com/v1/workspaces \
  -H "X-API-Key: <sk_aria_...>"
```

On the China site use host `https://memo.ariacompute.cn`.

## Workspace RBAC

Every business endpoint except `/v1/auth/*` and `/v1/apikeys` lives under a workspace and checks the caller's role there. Roles from lowest to highest:

| Role | Typical capability |
| - | - |
| `viewer` | Read knowledge, memory, wiki, etc. |
| `contributor` | In addition to `viewer`, write content/memory and run agents |
| `admin` | In addition to `contributor`, view audit logs |
| `owner` | Full control including member management and deletion |

Each endpoint notes its **minimum required role** in its Authentication section. Insufficient role returns `403 Forbidden`.

## Error responses

When auth is required but the credential is missing or invalid, the API returns `401`; insufficient role returns `403`. The error body is uniform:

```json theme={null}
{
  "error": {
    "message": "Unauthorized",
    "type": "401 Unauthorized"
  }
}
```


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