# Read a fix

Reads a fix you already unlocked, at no cost. If it is not unlocked yet, the answer is `404 fix_locked` and nothing is unlocked: use [Unlock the fix](https://docs.rustine.io/en/api/issues/unlock-fix).

```
GET https://api.rustine.io/v1/issues/{issue_id}/fix
```

OAuth permission: `scans:read` · an API key has them all

## Path parameters

- `issue_id` (string, required) Issue id.

## Response (200 OK)

- `object` (string, required)
- `issue_id` (string, required) The issue.
- `prompt` (string, required) The fix as instructions for a coding agent (Cursor, Claude Code…), to apply in the codebase. Rustine never edits code.
- `ai_fix` (string | null, required) A patch written by Rustine (unified diff), when one was generated in the app.

## Examples

### curl

```bash
# The key stays in a variable, never in the address
curl https://api.rustine.io/v1/issues/2a4c6e8f-0b1d-4f3a-9c5e-7a9b1c3d5e7f/fix \
  -H "Authorization: Bearer $RUSTINE_API_KEY"
```

### Node

```js
const res = await fetch(
  "https://api.rustine.io/v1/issues/2a4c6e8f-0b1d-4f3a-9c5e-7a9b1c3d5e7f/fix",
  {
    headers: {
      Authorization: `Bearer ${process.env.RUSTINE_API_KEY}`,
    },
  },
)
const fix = await res.json()
```

### Python

```python
import os

import requests

fix = requests.get(
    "https://api.rustine.io/v1/issues/2a4c6e8f-0b1d-4f3a-9c5e-7a9b1c3d5e7f/fix",
    headers={
        "Authorization": f"Bearer {os.environ['RUSTINE_API_KEY']}",
    },
).json()
```

### Response: 200 OK

```json
{
  "object": "fix",
  "issue_id": "2a4c6e8f-0b1d-4f3a-9c5e-7a9b1c3d5e7f",
  "prompt": "Your .env file is served publicly at https://app.example.com/.env.\n1. Remove .env from the public directory of the build…\n2. Rotate every secret it contained…",
  "ai_fix": null
}
```

## Errors

| Status | error.code | What happens |
| --- | --- | --- |
| 401 | `authentication_required` | No key in the request. Pass it in the `Authorization: Bearer rst_…` header, never in the address. |
| 401 | `invalid_api_key` | The key or OAuth token is wrong, revoked or expired. Check it is copied in full, or create a new key. |
| 402 | `api_plan_required` | The workspace is on the Free plan. The API comes with Pro, or on a 14-day trial with Solo. |
| 402 | `api_trial_ended` | Solo's 14-day trial is over. Move to Pro: your keys work again at once. |
| 403 | `scope_missing` | The OAuth token lacks the permission this route needs (shown on its page). Reconnect the agent to grant it. An API key has every permission. |
| 404 | `resource_not_found` | Nothing with this id in the key's workspace. An object of another workspace answers the same: its existence is never revealed. |
| 404 | `fix_locked` | The fix of this issue is not unlocked yet: `POST /issues/{issue_id}/fix` unlocks it. |
| 429 | `rate_limited` | Too many requests for this key (120 per minute). Wait `Retry-After` seconds. |
| 500 | `internal_error` | An error on our side, reported automatically. Retry later; give the `Request-Id` to support if it comes back. |
| 503 | `service_unavailable` | Rustine is unavailable for a moment. Retry with the same `Idempotency-Key`. |

https://docs.rustine.io/en/api/errors
