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 filter to apply to the query. Only one filter can be used at a time. When the filter is used,
jobStatusis ignored. The results are sorted by thecreatedAtfield, with the most recent jobs being first.- JOB_NAME
-
The value of the filter is a case-insensitive match for the job name. If the value ends with an asterisk (*), the filter matches any job name that begins with the string before the '*'. This corresponds to the
jobNamevalue. For example,test1matches bothTest1andtest1, andtest1*matches bothtest1andTest10. When theJOB_NAMEfilter is used, the results are grouped by the job name and version. - BEFORE_CREATED_AT
-
The value for the filter is the time that's before the job was created. This corresponds to the
createdAtvalue. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970. - AFTER_CREATED_AT
-
The value for the filter is the time that's after the job was created. This corresponds to the
createdAtvalue. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970.
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 | FAILEDRequired: No
- maxResults
-
The maximum number of results returned by
ListServiceJobsin paginated output. When this parameter is used,ListServiceJobsonly returnsmaxResultsresults in a single page and anextTokenresponse element. The remaining results of the initial request can be seen by sending anotherListServiceJobsrequest with the returnednextTokenvalue. This value can be between 1 and 100. If this parameter isn't used, thenListServiceJobsreturns up to 100 results and anextTokenvalue if applicable.Type: Integer
Required: No
- nextToken
-
The
nextTokenvalue returned from a previous paginatedListServiceJobsrequest wheremaxResultswas used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned thenextTokenvalue. This value isnullwhen 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
nextTokenvalue to include in a futureListServiceJobsrequest. When the results of aListServiceJobsrequest exceedmaxResults, this value can be used to retrieve the next page of results. This value isnullwhen 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: