# Make your first AI Studio API call

This quickstart uses the CloudSigma AI Studio HTTP API to list the workspaces available to your account, then lists workflows in one workspace.

## Before you begin

For regional endpoints, credentials, and workspace configuration, see [Endpoints & Authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md).

Prepare the following values:

- **Regional API base URL:** Use the endpoint for the region that contains your workspace. For Manila 2 (`mnl2`), use `https://genai.mnl2.cloudsigma.com/v5`.
- **Personal access token:** Create and copy a token from **Access credentials** in the CloudSigma console.
- **curl:** Use curl 7.61.0 or later to run the examples.

Store the endpoint and token in environment variables. Replace the example values with your own:

```bash
export CLOUDSIGMA_API_BASE='https://genai.mnl2.cloudsigma.com/v5'
export CLOUDSIGMA_API_KEY='<your-personal-access-token>'
```

Keep tokens out of source code, terminal output, and shared command history.

## 1. List available workspaces

Send a request to list the workspaces available to the current identity:

```bash
curl --get "$CLOUDSIGMA_API_BASE/workspaces" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY"
```

A successful request returns `200`. Copy a workspace ID from `data.workspaces[].id`, then store it for the next request:

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

For all request and response fields, see [List workspaces](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/workspaces/list-workspaces.html.md).

## 2. List workflows in the workspace

Workspace-scoped requests require both the personal access token and the workspace ID:

```bash
curl --get "$CLOUDSIGMA_API_BASE/workflow/v2/workflow-apps?offset=0&limit=20" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $CLOUDSIGMA_WORKSPACE_ID"
```

A successful request returns `200`. The workflow list is in `data.workflows`, and `data.total` contains the total number of matching workflows.

For all request and response fields, see [List workflows](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/data-processing/workflows/list-workflows.html.md).

## Troubleshooting

| Response | What to check |
| --- | --- |
| `401 Unauthorized` | Confirm that the personal access token is complete and is passed in `X-API-Key` without a `Bearer` prefix. |
| `403 Forbidden` | Confirm that the caller is a member of the target workspace and has permission to read the resource. |
| `404 Not Found` or an HTML response | Confirm that `CLOUDSIGMA_API_BASE` is the API base URL for the workspace's region and includes `/v5`. |
| Empty list | Confirm that you selected the expected region and workspace. An empty list can also mean that no matching resource has been created. |

## Next steps

- [Make your first request with the SDK](https://omnifabric.cloudsigma.com/docs/developer/quickstart/ai-studio/sdk.html.md)
- [Understand regions, workspaces, and resource relationships](https://omnifabric.cloudsigma.com/docs/developer/overview/concepts.html.md)
- [Choose an API guide](https://omnifabric.cloudsigma.com/docs/developer/api/index.html.md)
- [Run, resume, and retry workflow jobs](https://omnifabric.cloudsigma.com/docs/developer/api/ai-studio/data-processing/workflow-jobs-recovery.html.md)
