---
title: Retrieve and save job results
description: How to use job_id to retrieve results, and how to save results to disk.
source: https://eu-de.quantum.cloud.ibm.com/docs/en/guides/save-jobs
---

# Retrieve and save job results

### Package versions

The code on this page was developed using the following requirements.
We recommend using these versions or newer.

```
qiskit-ibm-runtime~=0.45.1
```

Quantum workflows often take a while to complete and can run over many sessions. Restarting your Python kernel means you'll lose any results stored in memory. To avoid loss of data, you can save results to file and retrieve results of past jobs from IBM Quantum® so your next session can continue where you left off.

## Retrieve job results from IBM Quantum

IBM Quantum automatically stores results from every job for you to retrieve at a later date. Use this feature to continue quantum programs across kernel restarts and review past results. You can get the ID of a job programmatically through its `job_id` method, or you can see all your submitted jobs and their IDs on the [Workloads page](/workloads).

To find a job programmatically, use the [`QiskitRuntimeService.jobs`](/docs/api/qiskit-ibm-runtime/qiskit-runtime-service#jobs) method. By default, this returns the most recently submitted jobs, but you can also filter jobs by backend name, creation date, and more. The following cell finds any jobs submitted in the last three months. The `created_after` argument must be a [`datetime.datetime`](https://docs.python.org/3.8/library/datetime.html#datetime.datetime) object.

```python
import datetime
from qiskit_ibm_runtime import QiskitRuntimeService

three_months_ago = datetime.datetime.now() - datetime.timedelta(days=90)

service = QiskitRuntimeService()
jobs_in_last_three_months = service.jobs(created_after=three_months_ago)
jobs_in_last_three_months[:3]  # show first three jobs
```

Output:

```
[<RuntimeJobV2('d762oo5bjrds73ed2u80', 'estimator')>,
 <RuntimeJobV2('d762omnq1anc738d2cj0', 'sampler')>,
 <RuntimeJobV2('d762oma3qcgc73fse6dg', 'sampler')>]
```

You can also select by backend, job state, session, and more. For more information, see [`QiskitRuntimeService.jobs`](/docs/api/qiskit-ibm-runtime/qiskit-runtime-service#jobs) in the API documentation.

Once you have the job ID, use the [`QiskitRuntimeService.job`](/docs/api/qiskit-ibm-runtime/qiskit-runtime-service#job) method to retrieve it.

```python
# Get ID of most recent successful job for demonstration.
# This will not work if you've never successfully run a job.
successful_job = next(
    j for j in service.jobs(limit=1000) if j.status() == "DONE"
)
job_id = successful_job.job_id()
print(job_id)
```

Output:

```
d762omnq1anc738d2cj0
```

```python
retrieved_job = service.job(job_id)
retrieved_job.result()
```

Output:

```
PrimitiveResult([SamplerPubResult(data=DataBin(meas=BitArray(<shape=(), num_shots=4096, num_bits=127>)), metadata={'circuit_metadata': {}})], metadata={'execution': {'execution_spans': ExecutionSpans([DoubleSliceSpan(<start='2026-03-31 20:19:56', stop='2026-03-31 20:19:58', size=4096>)])}, 'version': 2})
```

## Save results to disk

You may also want to save results to disk. To do this, use Python's built-in JSON library with encoders from `qiskit-ibm-runtime`.

```python
import json
from qiskit_ibm_runtime import RuntimeEncoder

with open("result.json", "w") as file:
    json.dump(retrieved_job.result(), file, cls=RuntimeEncoder)
```

You can then load this array from disk in a separate kernel.

```python
from qiskit_ibm_runtime import RuntimeDecoder

with open("result.json", "r") as file:
    result = json.load(file, cls=RuntimeDecoder)

result
```

Output:

```
PrimitiveResult([SamplerPubResult(data=DataBin(meas=BitArray(<shape=(), num_shots=4096, num_bits=127>)), metadata={'circuit_metadata': {}})], metadata={'execution': {'execution_spans': ExecutionSpans([DoubleSliceSpan(<start='2026-03-31 20:19:56', stop='2026-03-31 20:19:58', size=4096>)])}, 'version': 2})
```
