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

# Example Houston API queries

You can retrieve common information for specific Astronomer objects by using the following sample queries.

<a id="workspaces" />

### Finding the id of a workspace you belong to

Use the `workspaces` query to find the ID of a Workspace that you belong to. Optionally, you can choose to filter by Deployment label.

```graphql wrap theme={null}
query {
  workspaces(label:"example-workspace") {
    id,
    label
  }
}
```

<a id="sysWorkspaces" />

### Finding the id of all workspaces

System administrators can use the `sysWorkspaces` query to perform a bulk-fetch of all Workspaces and their respective IDs using the `sysWorkspaces` query. After retrieving the full list, you can filter the Workspaces within your application to locate the ID corresponding to the label of interest.

```graphql wrap theme={null}
query {
  sysWorkspaces {
    id,
    label
  }
}
```

### Query Deployment details

You can use the `workspaceDeployment` query to retrieve details about a Deployment in a given Workspace. It requires the following inputs:

* **Workspace ID**: To retrieve this value, use the [`sysWorkspaces`](#sysWorkspaces) or [`workspaces`](#workspaces) query, or run `astro workspace list`. Alternatively, open a Workspace in the Astro Private Cloud UI and copy the value after `/w/` in your Workspace URL, for example, `https://app.basedomain/w/<workspace-id>`.
* **Deployment release name**: To retrieve this value, run `astro deployment list` in your Workspace. Alternatively, you can copy the **Release name** from your Deployment's **Settings** tab in the Astro Private Cloud UI.

The `workspaceDeployment` query can return also any of the fields under `Type Details`, such as:

* `config`
* `uuid`
* `status`
* `createdAt`
* `updatedAt`
* `roleBindings`

For example, you can run the following query to retrieve the Deployment's:

* ID
* Health status
* Creation time
* Update time
* Users

```graphql wrap theme={null}
query workspaceDeployment {
  workspaceDeployment(
    releaseName: "mathematical-probe-2087"
    workspaceUuid: "ck35y9uf44y8l0a19cmwd1x8x"
  )
  {
    id
    status
    createdAt
    updatedAt
    roleBindings {
      id,
      role,
      user {
        username,
        emails {
          primary
        }
      }
    }
  }
}
```

### Query user details

A common query is `users`, which lets you retrieve information about multiple users at once. To use this query, you must provide:

* At least one of the following `userSearch` values:

  * `userId` (String): The user's ID
  * `userUuid`(String): The user's unique ID
  * `username` (String): The user's username
  * `email` (String): The user's email
  * `fullName` (String): The user's full name
  * `createdAt`(DateTime): When the user was created
  * `updatedAt`(DateTime): When the user was updated

The query returns the requested details for all users who exactly match the values provided for the `userSearch`. For example, the following query would retrieve the requested values for any user accounts with the email `name@mycompany.com`:

```graphql wrap theme={null}
query User {
  users(user: { email: "name@mycompany.com"} )
  {
    id
    roleBindings {role}
    status
    createdAt
  }
}
```
