Skip to main contentIBM Quantum Documentation

Jobs


Gets metrics of specified job

Get job metrics as an admin

Path Parameters

Name, TypeDescription
id
Required
string

HTTP Response Status Codes

Status codeDescription
200Various metrics about the execution of a job
401Unauthorized
403Forbidden
404Not found

Code samples

GET
/admin/jobs/{id}/metrics
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/admin/jobs/{id}/metrics \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "bss": {
    "seconds": 1
  },
  "usage": {
    "quantum_seconds": 10,
    "seconds": 10
  },
  "timestamps": {
    "created": "2022-06-20T12:55:20.268427Z",
    "finished": "2022-06-20T12:55:20.268427Z",
    "running": "2022-06-20T12:55:20.268427Z"
  },
  "executions": 10,
  "num_circuits": 10,
  "num_qubits": [
    1,
    2,
    3
  ],
  "circuit_depths": [
    1,
    2,
    3
  ],
  "qiskit_version": "0.36.2",
  "estimated_start_time": "2022-06-20T12:55:20.268427Z",
  "estimated_completion_time": "2022-06-20T12:55:20.268427Z",
  "position_in_queue": 10,
  "position_in_provider": 10
}

List user jobs

List user jobs

Query Parameters

Name, TypeDescription
provider
string

Instance to filter jobs. Should be in the following format {hub}/{group}/{project}

pending
boolean

Filters only pending or non pending jobs

backend
string

Comma separated systems to filter jobs

sort
string

Sort jobs by created time

Possible values: ASCDESC
Default value: DESC
limit
integer

Number of results to return at a time

Default value: 200
offset
integer

Number of results to offset when retrieving the list of jobs

createdAfter
string

Job created after filter

createdBefore
string

Job created before filter

tags
string[]

Tags to filter jobs

program
string

Program ID to filter jobs

sessionId
string

Session ID to filter jobs

composerOnly
boolean

Returns composer jobs only

Default value: false
composerFile
string

Composer file name to filter jobs

search
string

Searches for jobs containing the specified keyword in their id, name or tags

HTTP Response Status Codes

Status codeDescription
200OK
400Bad Request
401Unauthorized
403Forbidden

Code samples

GET
/facade/v1/jobs
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/facade/v1/jobs \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "jobs": [
    {
      "id": "c5dge2d3rn7breq27i9g",
      "hub": "ibm-q",
      "group": "open",
      "project": "main",
      "backend": "ibm_brisbane",
      "status": "Completed",
      "created": "2021-10-04T13:52:09.456851Z",
      "type": "RUNTIME",
      "tags": [
        "tag1",
        "tag2"
      ],
      "name": "",
      "runMode": "",
      "private": false,
      "endTime": "2021-10-04T13:54:09.456851Z",
      "state": {
        "status": "Completed",
        "reason": ""
      },
      "program": {
        "id": "myprogram-abcdef12345"
      },
      "runtime": "ntc-provider-primitives:latest",
      "sessionId": "123"
    }
  ],
  "count": 1,
  "limit": 1,
  "offset": 0
}

List tags

List tags containing the search keyword from all the user jobs

Query Parameters

Name, TypeDescription
search
Required
string

Lists job tags containing the keyword

limit
integer

Number of results to return at a time

Default value: 200
offset
integer

Number of results to offset when retrieving the list of jobs

HTTP Response Status Codes

Status codeDescription
200OK
400Bad Request
401Unauthorized
403Forbidden

Code samples

GET
/facade/v1/jobs/tags
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/facade/v1/jobs/tags \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ],
  "count": 3,
  "limit": 10,
  "offset": 0
}

Get job type

Get the type about the specified quantum job

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200Returns the job type
401Unauthorized
404Not found
500Internal server error

Code samples

GET
/facade/v1/jobs/{id}/type
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/facade/v1/jobs/{id}/type \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "id": "ch8b1ok4k9li68vm059r",
  "type": "IQX"
}

Run a job

Invoke a Qiskit Runtime primitive. Note the returned job ID. You will use it to check the job's status and review results.

Body Parameters (application/json)

Name, TypeDescription
program_id
Required
string

ID of the primitive to be executed

Example: "sampler"
hub
Required
string

The hub of the instance

Example: "ibm-q"
group
Required
string

The group of the instance

Example: "open"
project
Required
string

The project of the instance

Example: "main"
backend
Required
string

Name that identifies the system on which to run the job

Example: "ibm_sherbrooke"
params

Parameters to inject into the primitive as key-value pairs

Example: {"pubs":[["OPENQASM 3.0; include \\\"stdgates.inc\\\"; bit[2] meas; rz(pi/2) $0; sx $0; rz(pi/2) $0; cx $0, $1; meas[0] = measure $0; meas[1] = measure $1;",[],128]],"supports_qiskit":false,"version":2}
log_level
string

Logging level of the job

Possible values: criticalerrorwarninginfodebug
Example: "info"
session_id
string

Identifier of the session that the job is a part of

Example: "example_session_id"
tags
string[]

List of job tags

Example: ["job-1"]
cost
number

Cost of the job as the estimated time it should take to complete (in seconds). Should not exceed the cost of the primitive

Example: 450
private
boolean

Indicates if job to create will be private or not

HTTP Response Status Codes

Status codeDescription
200Returns the created job
400Bad request
401Unauthorized
403Forbidden
409Conflict
500Internal server error

Code samples

POST
/jobs
curl -X POST \
  https://api.quantum-computing.ibm.com/runtime/jobs \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"program_id":"sampler","hub":"ibm-q","group":"open","project":"main","backend":"ibm_sherbrooke"}'

Responses

{
  "id": "ci8fo2g4mgo3p0c53uc0",
  "backend": "ibmq_toronto",
  "session_id": "ci8fo2g4mgo3p0c53uc0",
  "messages": [
    {
      "level": "warn",
      "data": "Your current pending jobs are estimated to consume 200 quantum seconds, but you only have 100 quantum seconds left in your monthly quota; therefore, it is likely this job will be canceled"
    }
  ]
}

List jobs

List the quantum jobs you have run.

Query Parameters

Name, TypeDescription
limit
integer

Number of results to return at a time

Default value: 200
offset
integer

Number of results to offset when retrieving the list of jobs

pending
boolean

Returns 'Queued' and 'Running' jobs if true. Returns 'Completed', 'Cancelled', and 'Failed' jobs if false.

provider
string

Instance to filter jobs. Should be in the following format {hub}/{group}/{project}

program
string

Program ID to filter jobs

backend
string

System to filter jobs

created_after
string

Job created after filter

created_before
string

Job created before filter

sort
string

Sort jobs by created time ASC or DESC (default)

tags
string[]

Tags to filter jobs

session_id
string

Session ID to filter jobs

exclude_params
boolean

Exclude job params from the response

Default value: true

HTTP Response Status Codes

Status codeDescription
200OK
400Bad Request
401Unauthorized
403Forbidden
404Not Found

Code samples

GET
/jobs
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "jobs": [
    {
      "id": "c5dge2d3rn7breq27i9g",
      "backend": "ibm_brisbane",
      "state": {
        "status": "Completed",
        "reason": ""
      },
      "status": "Completed",
      "params": {
        "iterations": 3
      },
      "program": {
        "id": "sampler"
      },
      "created": "2021-10-04T13:52:09.456851Z",
      "ended": "2021-10-04T13:58:09.456851Z",
      "runtime": "ntc-provider-primitives:latest",
      "tags": [
        "tag1",
        "tag2",
        "tag3",
        "tag4"
      ],
      "session_id": "c5dge2d3rn7breq27i9g",
      "user_id": "66b151c0456fa30442933700",
      "usage": {
        "seconds": 1
      }
    }
  ],
  "count": 1,
  "limit": 1,
  "offset": 0
}

Get job

Get the details about the specified quantum job

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

Query Parameters

Name, TypeDescription
exclude_params
boolean

Exclude job params from the response

Default value: false

HTTP Response Status Codes

Status codeDescription
200Returns the job details
401Unauthorized
404Not found
500Internal server error

Code samples

GET
/jobs/{id}
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "id": "ch8b1ok4k9li68vm059r",
  "hub": "ibmq",
  "group": "open",
  "project": "main",
  "backend": "ibm_seattle",
  "state": {
    "status": "Cancelled",
    "reason": "Ran too long",
    "reason_code": 1234
  },
  "status": "Completed",
  "params": {},
  "program": {
    "id": "ch8b1ok4k9li68vm059r"
  },
  "created": "2021-05-05 00:56:04.569709",
  "ended": "2021-05-05 00:56:04.569709",
  "runtime": "example",
  "cost": 1,
  "tags": [
    "test-job"
  ],
  "session_id": "ch8b1ok4k9li68vm059r",
  "usage": {
    "seconds": 1
  },
  "estimated_running_time_seconds": 123,
  "estimated_max_running_time_seconds": 123,
  "private": true,
  "user_id": "66b151c0456fa30442933700"
}

Delete a job

Delete the specified job.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
204OK
401Unauthorized
403Forbidden
404Not Found

Code samples

DELETE
/jobs/{id}
curl -X DELETE \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

OK

Cancel a job

Cancels the specified job.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
204OK
401Unauthorized
403Forbidden
404Not Found
409Job is in non cancellable status.

Code samples

POST
/jobs/{id}/cancel
curl -X POST \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/cancel \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

OK

List job interim results

Return the interim results from this job. Interim results are kept two days after the job has finished running.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200Returns job interim results.
401Unauthorized
403Forbidden
404Not Found

Code samples

GET
/jobs/{id}/interim_results
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/interim_results \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

Returns job interim results.

List job logs

List all job logs for the specified job.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200Returns job logs.
401Unauthorized
403Forbidden
404Not found

Code samples

GET
/jobs/{id}/logs
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/logs \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

Returns job logs.

Get job metrics

Gets metrics of specified job

HTTP Response Status Codes

Status codeDescription
200OK
401Unauthorized
403Forbidden
404Not Found

Code samples

GET
/jobs/{id}/metrics
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/metrics \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "timestamps": {
    "created": "2022-06-20T12:55:20.268427Z",
    "running": "2022-06-20T12:55:20.268427Z",
    "finished": "2022-06-20T12:55:20.268427Z"
  },
  "bss": {
    "seconds": 123
  },
  "usage": {
    "quantum_seconds": 123,
    "seconds": 123
  },
  "executions": 123,
  "num_circuits": 123,
  "num_qubits": [
    1,
    2,
    3
  ],
  "circuit_depths": [
    0,
    1,
    2,
    3
  ],
  "qiskit_version": "0.36.2",
  "estimated_start_time": "2022-06-20T12:55:20.268427Z",
  "estimated_completion_time": "2022-06-20T12:55:20.268427Z",
  "position_in_queue": 10,
  "position_in_provider": 10
}

Get job results

Return the final result from this job.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200Return the job results
204The job exists but there is no result
401Unauthorized
404Not found
500Internal server error

Code samples

GET
/jobs/{id}/results
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/results \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

Return the job results

Replace job tags

Replace job tags

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

Body Parameters (application/json)

Name, TypeDescription
tags
Required
string[]

List of job or program tags

HTTP Response Status Codes

Status codeDescription
204OK
401Unauthorized
403Forbidden
404Not Found

Code samples

PUT
/jobs/{id}/tags
curl -X PUT \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/tags \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"tags":["example"]}'

Responses

OK

Get job transpiled circuits

Return a presigned download URL for the transpiled circuits. Currently supported only for the sampler primitive.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200Returns a presigned URL to download job transpiled circuits.
401Unauthorized
403Forbidden
404Not Found

Code samples

GET
/jobs/{id}/transpiled_circuits
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/jobs/{id}/transpiled_circuits \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

{
  "url": "https://quantum.ibm.com/transpiled-circuit/url"
}

Get jobs state updates

Get jobs state updates

HTTP Response Status Codes

Status codeDescription
200WebSocket stream
303Found
401Unauthorized
500Internal error

Code samples

GET
/stream/jobs
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/stream/jobs \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

WebSocket stream

Get the job results stream

Get a result stream as the job runs.

Path Parameters

Name, TypeDescription
id
Required
string

Identifier of an existing job

HTTP Response Status Codes

Status codeDescription
200WebSocket stream
303Found
401Unauthorized
500Internal error

Code samples

GET
/stream/jobs/{id}
curl -X GET \
  https://api.quantum-computing.ibm.com/runtime/stream/jobs/{id} \
  -H 'Authorization: Bearer YOUR-TOKEN' \
  -H 'Accept: application/json'

Responses

WebSocket stream
Was this page helpful?
Report a bug or request content on GitHub.