---
keyword: [Extend, Workday Graph API, Graph API, GraphQL]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Reference: Workday Graph API
layout: subsection
---

<a id="section_krp_22l_rtb"></a>
The Workday Graph API provides a single endpoint that submits any query or mutation.

## <a id="section_k1y_xyk_rtb"></a>Graph API Endpoint

```
https://api.workday.com/graphql/{version}
```

<b>Note:</b> Your account region determines the base URL of the Graph API endpoint. See [Reference: Workday Extend API Gateways and Authorization Base URLs](/wcp_docs/dlh1653340161856.html).

You can see the available versions of the Graph API endpoint in the [Graph API Explorer](/wcp_docs/jfi1654276754280.html).

## <a id="section_i3n_2zk_rtb"></a>HTTP Method

POST

## <a id="section_csz_fzk_rtb"></a>Request Body

A JSON map with these keys:

-   <b>query</b>

    A string containing the query or mutation.

    <b>Note:</b> The Graph API Explorer and the `graphQuery` attribute of an endpoint in an Extend PMD page enables you to enter the query in multiple lines. In Orchestration Builder and other REST API tools such as Postman, the query or mutation must be in a single line and cannot include newline characters.

-   <b>variables</b>

    A JSON map containing the query variables.



Sample request body containing a query:

```
{
"query": "query workerSingleLine($dataSourceVariables: Worker_DataSources!) { worker(dataSource: $dataSourceVariables) { data { workdayID { id } businessTitle } }}",
"variables": {
  "dataSourceVariables": {
      "indexedAllWorkers": {
          "filter": {
              "indexedAllWorkersFilter": {
                  "isActive": true
              }
          }
      }
  }
}
}
```

Sample request body containing a mutation:

```
{
"query": "mutation createProcurementRequisitionSingleLine($createProcurementRequisition_input: Procurement_CreateRequisitionRepresentation_CreateInput!) { createProcurementRequisition( input: $createProcurementRequisition_input ) {descriptor id {id} }}",
"variables": {
  "createProcurementRequisition_input": {
      "requester": {
          "id": {
              "id": "3aa5550b7fe348b98d7b5741afc65534",
              "type": "WID"
          }
      },
      "memo": "Mobile gadget request for project 1",
      "requisitionLines": [
          {
              "item": {
                  "id": {
                      "id": "c81b4811f29e4014bb5321b57b8e1f31",
                      "type": "WID"
                  }
              },
              "quantity": 5
          }
      ]
  }
}
}
```

## <a id="section_fbh_nzk_rtb"></a>Response Status Codes

-   <b>200</b>

    Indicates that the Graph API endpoint successfully parsed and submitted the request to the Graph API server.

    The Graph API endpoint returns the 200 status code in these situations:

    -   Successful response with requested data. Example:

        ```
        {
        "data": {
          "worker": {
              "data": [
                  {
                      "workdayID": {
                          "id": "7687e33f159501d988232f3bc6572e45"
                      },
                      "businessTitle": "Customer Service Representative"
                  },
                  . . .
              ]
          }
        }
        }
        ```

    -   Response contains partial data, warnings, and errors from the query or mutation.

        If the query or mutation encounters an error or warning while resolving the fields during execution, Graph API returns the 200 status code, partial data, and a list of warnings or errors. For a request containing multiple queries and mutations, a query can have a successful response while another can have a null response with errors. Example:

        ```
        {
        "data": {
        "me": {
          "data": [
            {
              "workdayID": {
                "id": "3aa5550b7fe348b98d7b5741afc65534"
              },
              "descriptor": "Logan McNeil"
            }
          ]
        },
        "employees": null
        },
        "errors": [
        {
          "message": "cannot resolve instance MyWorkerType",
          "path": [
            "employees"
          ],
          "locations": [
            {
              "line": 9,
              "column": 3
            }
          ],
          "extensions": {
            "statusCode": 400
          }
        }
        ]
        }
         
        ```


    To determine any failure, check for `errors[]` in the response body. In a PMD of an Extend app, if the Graph API endpoint response contains `errors[]`, the page treats it as an error, even if the response status code is 200.

-   <b>400</b>

    Unsuccessful query or mutation.

-   <b>401</b>

    Authentication failure.

-   <b>405</b>

    Method not allowed.

    Ensure that the Graph API endpoint uses the POST method.

-   <b>429</b>

    Too many requests.

    The number of requests and complexity of queries or mutations have reached the rate limiting threshold in your tenant. See [Reference: Limits on Graph API](/wcp_docs/GUID-2c1bf9a6-e073-4a5c-a631-6467554546d1.html).



## <a id="section_1"></a>Response Schema

The response is a JSON map containing:

-   <b>data</b>

    A map containing the results, whose root field is the name of the query or mutation operation. The data structure under the root field follows the requested data structure in the query or mutation.

-   <b>errors</b>

    A list of errors, which can include:

    -   Request errors due to invalid syntax, missing arguments, invalid input types and variables, and other errors encountered before the execution begins.
    -   Field errors encountered while executing field value resolutions.

    Each error contains these fields:

    -   <b>message</b>

        The error message.

    -   <b>locations</b>

        A list of line and column locations in the input request where the error occurred.

    -   <b>path</b>

        The full path to the field that encountered the error. The field path uses the standard GraphQL format, which is a serialized array. At the root, the path is`["rootField"]`, which is the name of the query or mutation root field.

    -   <b>extensions</b>

        -   <b>code</b>

            The error code from the underlying service.

        -   <b>field</b>

            The field that encountered the error.

        -   <b>path</b>

            The full path to the field that encountered the error. The field path uses the standard GraphQL format, which is a serialized array: `["pathSegment1", "pathSegmentN", "fieldName"]`. The sequential items in the array represent the hierarchical levels leading to the field provided by the underlying service.

        -   <b>severity</b>

            When a validation fails, the error response includes the `severity` field, which is either `Critical` or `Warning`.

            If a Graph API mutation request doesn't include the `wd-warning-action: updateonwarning` value and the request encounters warning validations, the errors response includes the warning messages with the `severity` field set to `Warning`.

        -   <b>statusCode</b>

            The HTTP status code from the underlying service.

        -   <b>internalMessage</b>

            Description about the error from the underlying service.

        -   <b>caseId</b>

            The ID provided when debugging internal server errors.

        -   <b>classification</b>

            The type of severity of the validation error.



-   <b>extensions</b>

    -   <b>warnings</b>

        A list of warning messages and their codes. If a Graph API mutation request includes the `wd-warning-action: updateonwarning` header value and the request encounters warning validations, the data response includes the warning messages.

        Graph API queries can return a list of warnings about inaccessible fields due to insufficient permissions on a data source or data source filter.

        A warning contains:

        -   <b>message</b>

            The warning message.

        -   <b>code</b>

            The warning code.

            Graph API query warning codes:

            -   S39: Inaccessible data source.
            -   S40: Inaccessible data source filter.
            -   S41: Inaccessible field.

        -   <b>field</b>

            The name of the inaccessible field.





This sample error response contains `extensions` objects, which include the path to the fields that caused validation errors:

```
{
"data": {
  "createRecruitingProspect": null
},
"errors": [
  {
    "message": "Invalid id for field",
    "path": [
      "createRecruitingProspect"
    ],
    "locations": [
      {
        "line": 3,
        "column": 3
      }
    ],
    "extensions": {
      "code": "S5",
      "path": [
        "candidate",
        "name",
        "salutation"
      ],
      "severity": "Critical",
      "field": "salutation",
      "statusCode": 400
    }
  },
  {
    "message": "Invalid id for field",
    "path": [
      "createRecruitingProspect"
    ],
    "locations": [
      {
        "line": 3,
        "column": 3
      }
    ],
    "extensions": {
      "code": "S5",
      "path": [
        "candidate",
        "name"
      ],
      "severity": "Critical",
      "field": "name",
      "statusCode": 400
    }
  }
]
}
```

