ListServiceJobs
Returns a list of service jobs for a specified job queue.
Request Syntax
POST /v1/listservicejobs HTTP/1.1
Content-type: application/json
{
"filters": [
{
"name": "string
",
"values": [ "string
" ]
}
],
"jobQueue": "string
",
"jobStatus": "string
",
"maxResults": number
,
"nextToken": "string
"
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- filters
-
The filters to apply to the service job list query. The filter names and values can be:
-
name:
JOB_STATUS
values:
SUBMITTED | PENDING | RUNNABLE | STARTING | RUNNING | SUCCEEDED | FAILED | SCHEDULED
-
name:
JOB_NAME
values: case-insensitive matches for the job name. If a filter value ends with an asterisk (*), it matches any job name that begins with the string before the '*'.
Type: Array of KeyValuesPair objects
Required: No
-
- jobQueue
-
The name or ARN of the job queue with which to list service jobs.
Type: String
Required: No
- jobStatus
-
The job status with which to filter service jobs.
Type: String
Valid Values:
SUBMITTED | PENDING | RUNNABLE | SCHEDULED | STARTING | RUNNING | SUCCEEDED | FAILED
Required: No
- maxResults
-
The maximum number of results returned by
ListServiceJobs
in paginated output. When this parameter is used,ListServiceJobs
only returnsmaxResults
results in a single page and anextToken
response element. The remaining results of the initial request can be seen by sending anotherListServiceJobs
request with the returnednextToken
value. This value can be between 1 and 100. If this parameter isn't used, thenListServiceJobs
returns up to 100 results and anextToken
value if applicable.Type: Integer
Required: No
- nextToken
-
The
nextToken
value returned from a previous paginatedListServiceJobs
request wheremaxResults
was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned thenextToken
value. This value isnull
when there are no more results to return.Note
Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.
Type: String
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"jobSummaryList": [
{
"createdAt": number,
"jobArn": "string",
"jobId": "string",
"jobName": "string",
"latestAttempt": {
"serviceResourceId": {
"name": "string",
"value": "string"
}
},
"serviceJobType": "string",
"shareIdentifier": "string",
"startedAt": number,
"status": "string",
"statusReason": "string",
"stoppedAt": number
}
],
"nextToken": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- jobSummaryList
-
A list of service job summaries.
Type: Array of ServiceJobSummary objects
- nextToken
-
The
nextToken
value to include in a futureListServiceJobs
request. When the results of aListServiceJobs
request exceedmaxResults
, this value can be used to retrieve the next page of results. This value isnull
when there are no more results to return.Type: String
Errors
- ClientException
-
These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.
HTTP Status Code: 400
- ServerException
-
These errors are usually caused by a server issue.
HTTP Status Code: 500
Examples
In the following example or examples, the Authorization header contents
(
[authorization-params]
) must be replaced with an AWS Signature Version 4
signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the
AWS
General Reference.
You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI)
Example
This example lists all succeeded service jobs from the specified job queue.
Sample Request
POST /v1/listservicejobs HTTP/1.1
Host: batch.us-east-1.amazonaws.com
Accept-Encoding: identity
Content-Length: [content-length]
Authorization: [authorization-params]
X-Amz-Date: 20250801T103040Z
User-Agent: aws-cli/2.27.33 Python/3.13.4 Darwin/24.3.0
{
"jobQueue": "sagemaker-training-queue",
"jobStatus": "SUCCEEDED",
"maxResults": 10
}
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: [content-length]
Connection: keep-alive
Date: Fri, 01 Aug 2025 10:30:41 GMT
x-amzn-RequestId: [request-id]
X-Amzn-Trace-Id: [trace-id]
X-Cache: Miss from cloudfront
Via: 1.1 fnhd4k2s8l3n6p9r2t5u8v1w4y7zexample.cloudfront.net (CloudFront)
X-Amz-Cf-Id: mno6pqr9stu2vwx5yz8901defghijklmnopqrstuvexample
{
"jobSummaryList": [
{
"jobId": "a4d6c728-8ee8-4c65-8e2a-9a5e8f4b7c3d",
"jobName": "sagemaker-training-job-example",
"jobArn": "arn:aws:batch:us-east-1:123456789012:service-job/a4d6c728-8ee8-4c65-8e2a-9a5e8f4b7c3d",
"status": "SUCCEEDED",
"serviceJobType": "SAGEMAKER_TRAINING",
"createdAt": 1722507600000,
"startedAt": 1722507660000,
"stoppedAt": 1722511260000,
"latestAttempt": {
"serviceResourceId": {
"name": "TrainingJobArn",
"value": "arn:aws:sagemaker:us-east-1:123456789012:training-job/sagemaker-training-job-example"
}
}
},
{
"jobId": "b7e9f032-1aa2-4d78-9b3c-8e6f5a4d2c1b",
"jobName": "image-classification-training",
"jobArn": "arn:aws:batch:us-east-1:123456789012:service-job/b7e9f032-1aa2-4d78-9b3c-8e6f5a4d2c1b",
"status": "SUCCEEDED",
"serviceJobType": "SAGEMAKER_TRAINING",
"createdAt": 1722495000000,
"startedAt": 1722495120000,
"stoppedAt": 1722498720000,
"latestAttempt": {
"serviceResourceId": {
"name": "TrainingJobArn",
"value": "arn:aws:sagemaker:us-east-1:123456789012:training-job/image-classification-training-example"
}
}
}
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: