---
title: GetWorkflowDefinition
source: https://docs.newrelic.com/docs/workflow-automation/workflow-automation-apis/get-workflow-definition
---

Use the `workflowAutomation.workflow` query to get and return a workflow definition.

## Input parameters [#input-parameters]

| Parameter          | Data type | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `account.id`       | Number    | (Required) Your account ID.                                    |
| `workflow.name`    | String    | (Required) The name of the workflow definition to retrieve.    |
| `workflow.version` | Number    | (Required) The version of the workflow definition to retrieve. |

## Sample request [#sample-request]

Use the [Query Builder](https://one.newrelic.com/nerdgraph-graphiql?state=c8579e50-f154-fec6-22b8-f9fdcfc1990a) to create and edit a workflow. See [NerdGraph API explorer](https://docs.newrelic.com/docs/apis/nerdgraph/get-started/nerdgraph-explorer).

```graphql
{
  actor {
    account(id: 12345678) {
      workflowAutomation {
        workflow(name: "my-workflow", version: 1) {
          definition {
            name
            version
            yaml
          }
        }
      }
    }
  }
}
```

## Sample response [#sample-response]

The query returns:

-   `definition.name`: The name of the workflow definition
-   `definition.version`: The version number of the workflow definition
-   `definition.yaml`: The base64-encoded workflow definition YAML

## Related topics [#related-topics]

[Get workflow definitions](https://docs.newrelic.com/docs/workflow-automation/workflow-automation-apis/get-workflow-definitions)

List all workflow definitions to find name and version

[Update workflow definition](https://docs.newrelic.com/docs/workflow-automation/workflow-automation-apis/update-workflow-definition)

Modify the retrieved workflow definition

[Start workflow run](https://docs.newrelic.com/docs/workflow-automation/workflow-automation-apis/start-workflow-run)

Execute this workflow definition

[Definition schema](https://docs.newrelic.com/docs/workflow-automation/workflow-automation-apis/definition-schema)

Understand the workflow YAML structure
