> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/queries/workflowactions.md).

# WorkflowActions

Retrieve the queries and updates currently available for a workflow execution

Audience: Programmer

Returns the queries and updates that a workflow execution currently accepts, together with an `enabled` flag that indicates whether each action is callable at this moment. Because Temporal workflows register and deregister handlers as they progress, the result of this query changes dynamically during the lifetime of a workflow run and reflects the workflow's state at the time of the call.

This query is useful for building UIs that expose workflow controls to users: clients can discover which interactions are valid without hard-coding workflow knowledge, and can render or disable buttons based on the `enabled` flag.

## Arguments

| Name    | Type                        | Description                                             |
| ------- | --------------------------- | ------------------------------------------------------- |
| `input` | `GetWorkflowActionsInput!`  | Input identifying the workflow run (required)           |
| `where` | `WorkflowActionsWhereInput` | Optional filter that narrows which actions are returned |

### GetWorkflowActionsInput Fields

| Field                 | Type      | Description                                     |
| --------------------- | --------- | ----------------------------------------------- |
| `workflowId`          | `String!` | The unique identifier of the workflow           |
| `workflowExecutionId` | `String!` | The specific execution (run) ID of the workflow |

### WorkflowActionsWhereInput Fields

| Field              | Type        | Description                                                                             |
| ------------------ | ----------- | --------------------------------------------------------------------------------------- |
| `name`             | `String`    | Optional exact-match filter on the action name                                          |
| `nameNEQ`          | `String`    | Matches actions whose name is **not** equal to the value                                |
| `nameIn`           | `[String!]` | Matches actions whose name is in the provided list                                      |
| `nameNotIn`        | `[String!]` | Matches actions whose name is **not** in the provided list                              |
| `nameContains`     | `String`    | Matches actions whose name contains the substring (case-sensitive)                      |
| `nameHasPrefix`    | `String`    | Matches actions whose name starts with the prefix (case-sensitive)                      |
| `nameHasSuffix`    | `String`    | Matches actions whose name ends with the suffix (case-sensitive)                        |
| `nameEqualFold`    | `String`    | Matches actions whose name equals the value, ignoring case                              |
| `nameContainsFold` | `String`    | Matches actions whose name contains the substring, ignoring case                        |
| `enabled`          | `Boolean`   | Optional filter by enabled state. Pass `true` to only return currently callable actions |

All predicates are AND-joined; an action must satisfy every predicate you set. Unset predicates (omitted fields, `null`, empty strings, and empty lists) are ignored and match every action. See [WorkflowActionsWhereInput](/graphql-api/inputs/workflowactionswhereinput.md) for full details.

## Return Type

`GetWorkflowActionsResponse!` - A response containing two lists of registered actions (non-nullable).

### GetWorkflowActionsResponse Fields

| Field     | Type                   | Description                                      |
| --------- | ---------------------- | ------------------------------------------------ |
| `queries` | `[ActionDefinition!]!` | The queries registered on the workflow execution |
| `updates` | `[ActionDefinition!]!` | The updates registered on the workflow execution |

### ActionDefinition Fields

| Field         | Type       | Description                                                        |
| ------------- | ---------- | ------------------------------------------------------------------ |
| `name`        | `String!`  | The name under which the action is registered                      |
| `description` | `String`   | Optional human-readable description of what the action does        |
| `enabled`     | `Boolean!` | Whether the action is currently callable on the workflow execution |

## Usage Example

### GraphQL Query

```graphql
query GetWorkflowActions($input: GetWorkflowActionsInput!, $where: WorkflowActionsWhereInput) {
  workflowActions(input: $input, where: $where) {
    queries {
      description
      enabled
      name
    }
    updates {
      description
      enabled
      name
    }
  }
}
```

### Variables

```json
{
  "input": {
    "workflowExecutionId": "test-run-id",
    "workflowId": "workflow-id"
  },
  "where": {
    "enabled": true
  }
}
```

### JavaScript Example

```javascript
const query = `
  query GetWorkflowActions($input: GetWorkflowActionsInput!, $where: WorkflowActionsWhereInput) {
    workflowActions(input: $input, where: $where) {
      queries {
        description
        enabled
        name
      }
      updates {
        description
        enabled
        name
      }
    }
  }
`;

const variables = {
  input: {
    workflowId: "order-processing-workflow-123",
    workflowExecutionId: "run-456-xyz"
  },
  where: {
    enabled: true
  }
};

const response = await fetch('/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${token}`
  },
  body: JSON.stringify({ query, variables })
});

const result = await response.json();
const { queries, updates } = result.data.workflowActions;

console.log(`Callable queries: ${queries.map(q => q.name).join(', ')}`);
console.log(`Callable updates: ${updates.map(u => u.name).join(', ')}`);
```

## Response Example

```json
{
  "data": {
    "workflowActions": {
      "queries": [
        {
          "name": "getStatus",
          "description": "Returns the current status of the workflow",
          "enabled": true
        },
        {
          "name": "getProgress",
          "description": "Returns the picking progress as a percentage",
          "enabled": true
        }
      ],
      "updates": [
        {
          "name": "confirmPick",
          "description": "Confirm that a pick has been completed",
          "enabled": true
        }
      ]
    }
  }
}
```

### Filtering by Name

Pass a `name` in the `where` argument to fetch a single action:

```graphql
query {
  workflowActions(
    input: {
      workflowId: "order-processing-workflow-123"
      workflowExecutionId: "run-456-xyz"
    }
    where: { name: "confirmPick" }
  ) {
    updates {
      name
      enabled
      description
    }
  }
}
```

### Filtering by Name Predicate

Beyond exact matches, you can filter using string predicates such as `nameHasPrefix`, `nameContains`, or `nameIn`. The following query returns only the callable actions whose name starts with `ship`:

```graphql
query {
  workflowActions(
    input: {
      workflowId: "order-processing-workflow-123"
      workflowExecutionId: "run-456-xyz"
    }
    where: {
      nameHasPrefix: "ship"
      enabled: true
    }
  ) {
    updates {
      name
      enabled
      description
    }
  }
}
```

Predicates combine with AND, so the example above returns an action only if its name starts with `ship` **and** it is currently callable. For a case-insensitive match, use `nameContainsFold` or `nameEqualFold` instead.

## Error Handling

The query may return errors in the following cases:

### Invalid WorkflowID

```json
{
  "errors": [{
    "message": "invalid workflowId",
    "path": ["workflowActions"]
  }]
}
```

### Invalid WorkflowExecutionID

```json
{
  "errors": [{
    "message": "invalid workflowExecutionId",
    "path": ["workflowActions"]
  }]
}
```

### Workflow Not Found

```json
{
  "errors": [{
    "message": "workflow not found: order-processing-workflow-123",
    "path": ["workflowActions"]
  }]
}
```

### Workflow Execution Completed

Workflow executions that have already completed no longer expose callable queries or updates. In that case, both `queries` and `updates` are typically empty or all actions are returned with `enabled: false`.

## Notes

* The result is a snapshot in time. Because Temporal workflows can register and deregister handlers as they progress, calling `workflowActions` again later may return a different set of actions.
* The `enabled` flag reflects whether the action is callable right now. A handler may be registered but temporarily disabled while the workflow is in a particular state.
* Use the `where` argument to reduce the payload when you are only interested in currently callable actions or actions matching a name predicate (exact match, prefix, suffix, substring, or list membership).
* Action definitions are filtered in memory after the full set is fetched, so all predicates in `where` are AND-joined and evaluated directly against each action name.
* Queries returned by this endpoint are Temporal workflow queries (read-only), while updates are Temporal workflow updates (can modify workflow state).
* Requires valid authentication and appropriate tenant context.

## Related Types

* [GetWorkflowActionsInput](/graphql-api/inputs/getworkflowactionsinput.md)
* [WorkflowActionsWhereInput](/graphql-api/inputs/workflowactionswhereinput.md)
* [GetWorkflowActionsResponse](/graphql-api/types/getworkflowactionsresponse.md)
* [ActionDefinition](/graphql-api/types/actiondefinition.md)

## Service

This query is provided by the **workflow** service as part of the federated GraphQL schema.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/queries/workflowactions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
