# Get Information About All Query Jobs

Gets information about all query jobs in the org. The information includes Bulk API 2.0 query jobs and all Bulk API jobs. Job records are returned in an indeterminate order.

## Syntax

**URI:**

`/services/data/vXX.X/jobs/query`

```nolang
/services/data/vXX.X/jobs/query/
   ?isPkChunkingEnabled=isPkChunkingEnabled
   &jobType=jobType
   &concurrencyMode=concurrencyMode
   &queryLocator=queryLocator
```

**Available since release:**

This resource is available in API version 47.0 and later.

**Formats:** JSON

**HTTP methods:** GET

**Authentication:** Authorization: Bearer token

**Request parameters:**

| Parameter             | Description                                                                                                                                                                                                                                                                                                                                                                     | Required or Optional |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| `isPkChunkingEnabled` | If set to true, the request only returns information about jobs where PK Chunking is enabled. This only applies to Bulk API (not Bulk API 2.0) jobs. For more information on PK Chunking, see [Use PK Chunking to Extract Large Data Sets from Salesforce](https://developer.salesforce.com/blogs/engineering/2015/03/use-pk-chunking-extract-large-data-sets-salesforce.html). | Optional             |
| `jobType`             | Gets information only about jobs matching the specified job type. Possible values are:<ul><li>`Classic`—Bulk API jobs. This includes both query jobs and ingest jobs.</li><li>`V2Query`—Bulk API 2.0 query jobs.</li><li>`V2Ingest`—Bulk API 2.0 ingest (upload and upsert) jobs.</li></ul>                                                                                     | Optional             |
| `concurrencyMode`     | For future use. Gets information only about jobs matching the specified concurrency mode. Possible values are `serial` and `parallel`. Currently only parallel mode is supported.                                                                                                                                                                                               | Optional             |
| `queryLocator`        | Gets information about jobs starting with that locator value. Do not enter your own value here. Always use the value from the `nextRecordsUrl` from the previous set. See [Example](#example) and [Rules and Guidelines](#rules-and-guidelines).                                                                                                                                | Optional             |

**Response Body**

The response contains a completion flag, an array of records, and a locator value to be used to obtain more records. For example:

```nolang
{
   "done" : false,
   "records" : [
      {
         "id" : "750R0000000zhfdIAA",
         "operation" : "query",
         "object" : "Account",
         "createdById" : "005R0000000GiwjIAC",
         "createdDate" : "2018-12-07T19:58:09.000+0000",
         "systemModstamp" : "2018-12-07T19:59:14.000+0000",
         "state" : "JobComplete",
         "concurrencyMode" : "Parallel",
         "contentType" : "CSV",
         "apiVersion" : 68.0,
         "jobType" : "V2Query",
         "lineEnding" : "LF",
         "columnDelimiter" : "COMMA"
      },
      {
         "id" : "750R0000000zhjzIAA",
         "operation" : "query",
         "object" : "Account",
         "createdById" : "005R0000000GiwjIAC",
         "createdDate" : "2018-12-07T20:52:28.000+0000",
         "systemModstamp" : "2018-12-07T20:53:15.000+0000",
         "state" : "JobComplete",
         "concurrencyMode" : "Parallel",
         "contentType" : "CSV",
         "apiVersion" : 68.0,
         "jobType" : "V2Query",
         "lineEnding" : "LF",
         "columnDelimiter" : "COMMA"
      },
    ...
   ],
   "nextRecordsUrl" : "/services/data/v68.0/jobs/ingest?queryLocator=01gR0000000opRTIAY-2000"
}
```

**Response Parameters:**

<sfdocstbl><table>

<col>
</col>
<col>
</col>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    <th>
      Description
    </th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>
      <code>done</code>
    </td>
    <td>
      This is
      <code>true</code>
      if this is the last (or only) set of results. It is
      <code>false</code>
      if there are more records to fetch. See
      <a href="#example">Example</a>
      and
      <a href="#rules-and-guidelines">Rules and Guidelines</a>
      .
    </td>
  </tr>
  <tr>
    <td>
      <code>records</code>
    </td>
    <td>
      An array of record objects.
    </td>
  </tr>
  <tr>
    <td>
      <code>nextRecordsUrl</code>
    </td>
    <td>
      <p>
        The URI to get the next set of records (if there are any).
      </p>
      <p>
        This method returns up to 1,000 result rows per request. If there are more than 1,000 records, use the
        <code>nextRecordsUrl</code>
        to get the next set of records. See
        <a href="#example">Example</a>
        and
        <a href="#rules-and-guidelines">Rules and Guidelines</a>
        .
      </p>
      <p>
        This parameter is
        <code>null</code>
        if there are no more records to fetch.
      </p>
    </td>
  </tr>
</tbody>
</table></sfdocstbl>

**Record Objects**

| Parameter         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`              | The unique ID for this job.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `operation`       | The type of query. Possible values are:<ul><li>`query`—Returns data that hasn’t been deleted or archived. For more information, see [query()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_query.htm) in *SOAP API Developer Guide*.</li><li>`queryAll`—Returns records that have been deleted because of a merge or delete, and returns information about archived Task and Event records. For more information, see [queryAll()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_queryall.htm) in *SOAP API Developer Guide*.</li></ul> |
| `object`          | The object type being queried.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `createdById`     | The ID of the user who created the job.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `createdDate`     | The UTC date and time when the job was created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `systemModstamp`  | The UTC date and time when the API last updated the job information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `state`           | The current state of processing for the job. Possible values are: <ul><li>`UploadComplete`—The job is ready to be processed and Salesforce has put the job in the queue.</li><li>`InProgress`—Salesforce is processing the job.</li><li>`Aborted`—The job has been aborted. See [Abort a Query Job](/docs/platform/api-asynch/guide/query-abort-job.md).</li><li>`JobComplete`—Salesforce has finished processing the job.</li><li>`Failed`—The job failed.</li></ul>                                                                                                                                        |
| `concurrencyMode` | Reserved for future use. How the request is processed. Currently only parallel mode is supported. (When other modes are added, the API chooses the mode automatically. The mode isn’t user configurable.)                                                                                                                                                                                                                                                                                                                                                                                                    |
| `contentType`     | The format to be used for the results. Currently the only supported value is `CSV` (comma-separated variables). Defaults to `CSV`. The actual separator can be a character other than a comma. The `columnDelimiter` parameter specifies what character to use.                                                                                                                                                                                                                                                                                                                                              |
| `apiVersion`      | The API version that the job was created in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `lineEnding`      | The line ending used for CSV job data, marking the end of a data row. The default is `LF`. Possible values are:<ul><li>`LF`—linefeed character</li><li>`CRLF`—carriage return character followed by a linefeed character</li></ul>                                                                                                                                                                                                                                                                                                                                                                           |
| `columnDelimiter` | The column delimiter used for CSV job data. The default value is `COMMA`. Possible values are:<ul><li>`BACKQUOTE`—back quote character (`)</li><li>`CARET`—caret character (^)</li><li>`COMMA`—comma character (,)</li><li>`PIPE`—pipe character (\|)</li><li>`SEMICOLON`—semicolon character (;)</li><li>`TAB`—tab character</li></ul>                                                                                                                                                                                                                                                                      |

## Example

This example shows how to use the `nextRecordsUrl` query parameter.

The first request doesn’t use `nextRecordsUrl`, because we don’t know what value to use yet.

```nolang
curl --request GET \
--header "Authorization: Bearer TOKEN"
https://INSTANCE.salesforce.com/services/data/vXX.X/jobs/query
```

The response body is:

```nolang
{
    "done": false,
    "nextRecordsUrl": "/services/data/vXX.X/jobs/ingest?queryLocator=01gRM000000NS1vYAG-1000",
    "records": [
        {
           ...
        }
   ]
}
```

Because there are more records than can be returned in a single response, the value of `done` in the response isn’t `true`. We use the value of `nextRecordsUrl`, `/services/data/vXX.X/jobs/ingest?queryLocator=01gRM000000NS1vYAG-1000`, as the URI to get the next set of records:

```nolang
curl --request GET \
--header "Authorization: Bearer TOKEN"
https://INSTANCE.salesforce.com/services/data/vXX.X/jobs/query?queryLocator=01gRM000000NS1vYAG-1000
```

Repeat this process until `done` is `true`, indicating that there are no more results to fetch.

## Rules and Guidelines

To use this URI, follow these rules and guidelines.

1. Use `/services/data/vXX.X/jobs/query` to get the first set of records.
2. If there are more records than can be listed, the response body has `done` set to `false`. Use the value of `nextRecordsUrl` to get the next set of records.
3. Repeat this process until `done` is `true`. That set is the last set of records.
