---
title: "Recommend the next action for an opportunity"
method: GET
path: "/v1/opportunities/{opportunity_id}/actions/next_action"
tags: ["Opportunities"]
---

# Recommend the next action for an opportunity

`GET /v1/opportunities/{opportunity_id}/actions/next_action`

## Request

- Base URL: `https://api.yardstick.team`
- URL: `https://api.yardstick.team/v1/opportunities/{opportunity_id}/actions/next_action`
- Auth: HTTP bearer

Recommend the next action for an opportunity

**Required scopes:** `opportunities:read`, `tasks:read`

Computes a recommendation envelope from the application's current status and any open `user_tasks` rows. Returns `{ recommended_action_key, target_status, rationale, requires_approval, can_complete_via_api, cannot_complete_reason }`. When the application is in a terminal status (`Hired`, `Withdrawn`, `Offer Rejected`, `Disqualified`), all action fields are `null` and `cannot_complete_reason` is `TASK_TERMINAL`. Other `cannot_complete_reason` values are `NO_REGISTRY_ACTION` and `OWNED_BY_LATER_API_CHILD` (see `docs/api/tasks-api.md`). Requires both `opportunities:read` and `tasks:read` because the recommendation reads from `user_tasks` on the application's behalf.

**Example (curl):**

```bash
curl https://api.yardstick.team/v1/opportunities/opp_def456/actions/next_action \
  -H 'Authorization: Bearer ys_sk_live_…'
```

**Example (TypeScript):**

```ts
await fetch(
  "https://api.yardstick.team/v1/opportunities/opp_def456/actions/next_action",
  { headers: { Authorization: `Bearer ${process.env.YS_API_KEY}` } },
).then((r) => r.json());
```

## Path parameters

- `opportunity_id` string, required

## Headers

- `X-Request-Id` string

## Response `200`

Success

- object

## Other responses

- `400`: Invalid request
- `401`: Authentication failure
- `403`: Permission denied (scope or feature flag)
- `404`: Resource not found. The error uses the resource-specific code and param names the exact body field or path parameter that referenced it.
- `409`: Conflict (e.g. idempotency key reuse with different body)
- `429`: Rate limited
- `500`: Internal error

---

[API](https://skmtc.dev/yardstick/apis/yardstick-public-api.md) · [All operations](https://skmtc.dev/yardstick/apis/yardstick-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/yardstick/apis/yardstick-public-api/revisions/bef1d2eaaaa1?raw)
