---
title: "Get a prediction"
method: GET
path: "/predictions/{prediction_id}"
---

# Get a prediction

`GET /predictions/{prediction_id}`

Get the current state of a prediction.

Example cURL request:

```console
curl -s \
  -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
  https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu
```

The response will be the prediction object:

```json
{
  "id": "gm3qorzdhgbfurvjtvhg6dckhu",
  "model": "replicate/hello-world",
  "version": "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
  "input": {
    "text": "Alice"
  },
  "logs": "",
  "output": "hello Alice",
  "error": null,
  "status": "succeeded",
  "created_at": "2023-09-08T16:19:34.765994Z",
  "data_removed": false,
  "started_at": "2023-09-08T16:19:34.779176Z",
  "completed_at": "2023-09-08T16:19:34.791859Z",
  "metrics": {
    "predict_time": 0.012683
  },
  "urls": {
    "web": "https://replicate.com/p/gm3qorzdhgbfurvjtvhg6dckhu",
    "get": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu",
    "cancel": "https://api.replicate.com/v1/predictions/gm3qorzdhgbfurvjtvhg6dckhu/cancel"
  }
}
```

`status` will be one of:

- `starting`: the prediction is starting up. If this status lasts longer than a few seconds, then it's typically because a new worker is being started to run the prediction.
- `processing`: the `predict()` method of the model is currently running.
- `succeeded`: the prediction completed successfully.
- `failed`: the prediction encountered an error during processing.
- `canceled`: the prediction was canceled by its creator.

In the case of success, `output` will be an object containing the output of the model. Any files will be represented as HTTPS URLs. You'll need to pass the `Authorization` header to request them.

In the case of failure, `error` will contain the error encountered during the prediction.

Terminated predictions (with a status of `succeeded`, `failed`, or `canceled`) will include a `metrics` object with a `predict_time` property showing the amount of CPU or GPU time, in seconds, that the prediction used while running. It won't include time waiting for the prediction to start. The `metrics` object will also include a `total_time` property showing the total time, in seconds, that the prediction took to complete.

All input parameters, output values, and logs are automatically removed after an hour, by default, for predictions created through the API.

You must save a copy of any data or files in the output if you'd like to continue using them. The `output` key will still be present, but it's value will be `null` after the output has been removed.

Output files are served by `replicate.delivery` and its subdomains. If you use an allow list of external domains for your assets, add `replicate.delivery` and `*.replicate.delivery` to it.

## Path parameters

- `prediction_id` string, required

## Response `200`

Success

- SchemasPredictionResponse
  - `completed_at` string, date-time — The time that the model completed the prediction and all outputs were uploaded
  - `created_at` string, date-time, required — The time that the prediction was created
  - `data_removed` boolean, required — Whether the prediction output has been deleted
  - `deadline` string, date-time — The absolute time at which the prediction will be automatically canceled if it has not completed
  - `deployment` string — The name of the deployment that created the prediction
  - `error` string, nullable, required — An error string if the model status is `"failed"`
  - `id` string, required
  - `input` object, required — The prediction input
  - `logs` string — The log output from the model
  - `metrics` object — Additional metrics associated with the prediction
    - `total_time` number — The total time, in seconds, that the prediction took to complete
  - `model` string, required — The name of the model that created the prediction
  - `output` unknown, required
  - `started_at` string, date-time — The time that the model began the prediction
  - `status` 'starting' | 'processing' | 'succeeded' | 'failed' | 'canceled', required
  - `urls` object, required — URLs for working with the prediction
    - `cancel` string, uri, required — Cancel the prediction via API
    - `get` string, uri, required — Retrieve the latest state of the prediction via API
    - `stream` string, uri — An event source to stream the output of the prediction via API
    - `web` string, uri, required — View the prediction in a browser
  - `version` union, required
    - string — The ID of the model version that created the prediction
    - 'hidden' — The model does not support versions, used by official models.

---

[API](https://skmtc.net/replicate/apis/replicate-http-api.md) · [All operations](https://skmtc.net/replicate/apis/replicate-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/replicate/replicate-http-api/versions/7a537f433b0b/schema)
