---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Workday AI Gateway, AI Gateway]
nav: wcp_docs
parent_url: /wcp_docs/
title: Reports and Tasks Discovery REST API
layout: subsection
---

The Reports and Tasks Discovery REST API helps you to discover Workday tasks and reports by asking questions using natural language. When you ask a question in your own words about specific data or an action you need to perform in Workday, the API returns a ranked list of related Workday reports and tasks.

By default, the Reports and Tasks Discovery API searches and returns standard reports only. To search both standard and custom reports, your tenant must opt in the <b>Task and Report Data</b> data category in the Workday AI Gateway Innovation Services. This data category enables the API to build a tenanted custom report model for searching.

For security and search efficiency purposes, the Reports and Tasks Discovery API searches only the reports and tasks that match the current user’s security permissions. The API applies the same contextual security and tenanted security configurations before returning the results.

Sample use case:

-   As an expense administrator, you want to know which Workday report that gives information about total spend per location. You can call the Reports and Tasks Discovery REST API to ask a question about the total spend and get the name of the related Workday reports.


## <a id="section_17"></a>URL Base Path

The Reports and Tasks Discovery REST API endpoint uses this base URL:

```
https://api.workday.com/ml/dataQuery/{version}
```

For regional URL base paths, see [Reference: Workday Extend API Gateways and Authorization Base URLs](/wcp_docs/dlh1653340161856.html).

## <a id="section_6"></a>Discovering Workday Reports and Tasks

To ask about specific data or action you want to perform in Workday, call this endpoint:

```
POST {baseURL}/reportsAndTasks
```

In the request body, specify:

-   `query` - (Required) A string containing a natural language query. The maximum length is 500 characters.
-   `topN` - (Optional) The maximum number of results to return. Must be a positive integer. Default to 10. The maximum is 20.
-   `useLLM` - (Optional) If true, the API uses LLM for post-processing in search. Use this field to adjust the quality and performance of the response.


The endpoint returns a list of Workday reports and tasks with their name, Workday ID, relevance score, and rank.

<b>Note:</b> The HTTP header `wd-user` is currently not used.

Response:

<table><thead><tr><th>Status Code</th><th>Description</th></tr></thead><tbody><tr><td>200</td><td><p>Returns a <code>predictions[]</code> list containing Workday reports and tasks with their name and Workday ID. Each item in <code>predictions[]</code> contains these response fields:</p><ul><li><code>name</code> - The Workday report or task.
</li><li><code>rank</code> - An ordered number based on the score.
</li><li><code>score</code> - The relevance score between 0.0 and 1.0. It is possible for the LLM to return top recommendations with identical scores of 1.0. We include score and rank to enable you to apply your own threshold mechanism.
</li><li><code>type</code> - Either standard or custom report.
</li><li><code>wid</code> - The Workday ID of the report or task.
</li></ul><p>An empty list indicates that there are no reports and tasks related to the query.</p></td></tr><tr><td>401</td><td>The client isn’t authenticated.</td></tr><tr><td>403</td><td><ul><li>Innovation Services not opted in. See <i>Tenant Availability and Setup</i> in <a href="/wcp_docs/GUID-6a9a5c40-42e1-4b9b-911d-ba5457fc61ce.html">Concept: Workday AI Gateway</a>.
</li><li>Insufficient permissions. Note that AI Gateway is available in:

<ul><li>Development tenants for all Extend customers.
</li><li>Non-Development tenants for Extend Professional customers <i>only</i>.
</li></ul></li></ul></td></tr><tr><td>422</td><td>Missing or invalid fields in the request body. Fix the required fields, as listed in the error messages.</td></tr></tbody></table><br/>

## <a id="section_16"></a>Example

This sample request returns the related Workday report based on the input question.

```
POST https://api.workday.com/ml/dataQuery/v1/reportsAndTasks
```

Request body:

```
{
"query": "What is the total spend based on the location of our US workers?",
"topN": 3
}
 
```

Sample response:

```
{
"predictions": [
 {
   "name": "~Stock~ Spend Amount by ~Country~",
   "wid": "f1f3660af80a4a66be8e1bb4c85f41f9",
   "type": "standardReport",
   "score": 1,
   "rank": 1
 }
],
"ml_feedback_id": "b9428bd16ec6471496d54de3676076bf"
}
 
```

## <a id="section_4"></a>Limitations

-   Currently, the supported language is English only.
-   The query string must be less than or equal to 500 characters.


