# Call the API

After completing this page, you will use a personal access token to list the workspaces visible to your account and save a workspace ID for later requests. For the full list of endpoints and request details, see [AI Studio](../../api/ai-studio/index.md).

## 1. Prepare connection details

Get the complete Product API base URL from your environment's developer connection information, and prepare a personal access token:

```bash
export PRODUCT_API_BASE_URL='<Product API Base URL ending in /newmoi>'
export PRODUCT_API_KEY='<your-personal-access-token>'
```

The Product API base URL must include `/newmoi`. The Product API uses `X-API-Key`; do not use the Genesis base URL or `Authorization: Bearer`.

## 2. List workspaces

```bash
curl "$PRODUCT_API_BASE_URL/workspaces" \
  -H "X-API-Key: $PRODUCT_API_KEY" \
  -H "Accept: application/json"
```

The workspace-discovery request does not send `X-Workspace-ID`. On success, `data.workspaces` contains the list of workspaces visible to the current identity.

## 3. Save a workspace ID

Select the target workspace from `data.workspaces[].id`:

```bash
export WORKSPACE_ID='<workspace-id-from-response>'
```

Subsequent workspace-resource requests must include both headers:

```text
X-API-Key: <PERSONAL_ACCESS_TOKEN>
X-Workspace-ID: <WORKSPACE_ID>
```

If the list is empty, confirm that the current account has created, joined, or accepted an invitation to the target workspace. Do not construct an ID from its name.

## Next steps

- Manage workspace members and permissions: see [Users and permissions](../../api/ai-studio/users-permissions/index.md)
- Run and track workflows: see [Run, resume, and retry workflow jobs](../../api/ai-studio/data-processing/workflow-jobs-recovery.md)
