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

This API gets and returns a workflow definition.

## Input parameters

| Parameter          | Type   | Required | Description                                         |
| ------------------ | ------ | -------- | --------------------------------------------------- |
| `account.id`       | Number | Yes      | Your account ID.                                    |
| `workflow.name`    | String | Yes      | The name of the workflow definition to retrieve.    |
| `workflow.version` | Number | Yes      | The version of the workflow definition to retrieve. |

## 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: 11933347) {
      workflowAutomation {
        workflow(name: "my-workflow", version: 1) {
          definition {
            name
            version
            yaml
          }
        }
      }
    }
  }
}
```

## 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
