You request a delivery for Friday. The service refuses because the route is full. An agent tries to recover and accepts delivery on Monday. It has found an available option, but may have failed the business objective: the materials were needed for an event on Saturday.
In this hypothetical example, a better error message would only solve part of the problem. The consumer needs a way to consider alternatives while preserving the original objective and making every concession visible. Changing a date is a business decision, even when the API can do it through a simple call.
I would design the rejection with a recovery path. Where relevant options exist and the consumer is entitled to know about them, the service can offer them. Each should explain what it preserves, what it changes and what still needs confirmation. Authorization to execute remains a separate boundary.
Start with the requirement the alternative no longer meets
An alternative is useful in relation to the request that could not be fulfilled. “Another delivery is available” provides little guidance. “Monday delivery is available to the same address at the same price” exposes a difference, but still does not establish whether that difference is acceptable.
I would distinguish mandatory requirements from preferences. If the person specified a deadline, searching beyond it may still provide useful context, provided those results are clearly marked as failing the deadline. They should not silently join the set of options that satisfy the request.
The origin of a requirement also matters. A preference inferred by an agent has a different status from an explicit customer condition. Without that distinction, the system may preserve a weak preference while abandoning the condition that made the operation worthwhile in the first place.
In a web application handling business operations, this separation supports a consistent decision for human and automated consumers. The interface can explain the concession; the API can represent it through a stable contract. Neither should invent what the customer will accept.
Explaining a refusal and proposing options are different jobs
RFC 9457 on problem details for HTTP APIs provides problem types and permits problem-specific extensions. It advises consumers against extracting structured information by parsing explanatory prose. That is a useful foundation for recovery contracts, but it does not define a universal format for alternatives.
I would document the rejection reason separately from the meaning of the options. A stock shortage might permit another product. An authorization refusal might require a different responsible person. Treating both as invitations to try different parameters can turn recovery into an attempt to bypass a rule.
A consumer also needs a safe response to an extension it does not understand. It should preserve the rejection and provide a comprehensible next step, rather than execute the first reference it encounters. Contract evolution must not depend on an agent guessing the meaning of newly introduced fields.
An option needs to expose the complete difference
Suppose, again hypothetically, the original request costs 100 euros. A proposed substitute costs 118 euros and adds 12 euros for transport. The total increase is 30 euros, not merely the product’s 18-euro difference. These figures illustrate the comparison; they are not prices from an actual service.
I would expose the differences relevant to the decision: total price, timing, quantity, characteristics, cancellation conditions and dependencies awaiting confirmation. The precise set depends on the domain. A supplier-defined “equivalent” label is insufficient when it hides a change that matters to the buyer.
A replacement may preserve a function while changing another important condition. Two components might fit the same machine yet require different maintenance. Unless an appropriate source has established technical equivalence, the service should present a candidate for assessment. Catalogue similarity must not become confirmed compatibility through confident wording.
Knowing an alternative exists does not grant access to every field
A suggestion endpoint remains an API requiring access control. OWASP’s guidance on broken object property level authorization addresses both exposure of properties the user cannot read and changes to properties they cannot modify.
I would apply those checks before returning alternatives. A customer may be allowed to see a free appointment without learning who occupies the others. They may see their applicable price without receiving internal margins or another company’s terms. Suggestions should not become a second route into protected data.
The article on security boundaries around MCP tools provides relevant context: exposing a capability requires control over its associated resources and actions. The same principle applies when a capability is presented as a convenient recovery from a previous failure.
Observed availability can change before selection
Another person may take the appointment or buy the last item between discovery and selection. I would therefore expose the observation’s temporal context and define which conditions must be confirmed when the option is executed.
If the product creates a real temporary hold, its contract should explain the hold’s scope and expiry. Otherwise, the interface should avoid wording that implies the option has been secured. A reference that lets someone inspect an alternative is not a reservation of that alternative.
At execution, the service rechecks the relevant conditions. A material change in price or timing may fall outside the earlier authorization. The response should return to the appropriate decision point, rather than silently choose a third option just to produce a final outcome. Repeated substitution can move surprisingly far from the original request.
List order also communicates a recommendation
The first result can look like the system’s preferred choice. I would explain the ranking criterion where it affects the decision: lowest total cost, shortest delay or closest match to an explicit preference. Different criteria can yield different first options, all available but suited to different objectives.
In supply chain management platforms, the comparison may involve logistics capacity, minimum order sizes and several suppliers’ lead times. Ranking by unit price while ignoring minimum quantities can favour the option requiring the largest total payment.
I would also distinguish options satisfying every requirement from suggestions requiring a concession. Mixing them into one ranking forces the consumer to reconstruct rules the service already knows. Where sponsorship or a commercial rule favours a result, that influence needs explicit treatment in the product rather than being disguised as technical suitability.
Finding no options is not a universal conclusion
A search can return nothing because the criteria were restrictive, only some suppliers were consulted or a dependency failed. Those situations require different decisions. An empty array should not conceal which one occurred.
If the search covered only two regions, its scope should be understandable. If a source was unavailable, the service must not conclude that the source has no stock. Broadening the search may help, but can introduce additional time, cost or data sharing that requires authorization of its own.
For an agent, the correct recovery may be to ask which constraint can change: the date or the budget? The question should follow from a specific incompatibility. It should not be a ritual when an available option already satisfies all authorized conditions. Useful autonomy depends on understanding where discretion actually exists.
Evaluate recovery through decisions that genuinely diverge
I would assess this design using prepared scenarios, without presenting that proposed assessment as testing already performed. Cases should include a cheaper but later alternative, a dearer punctual one, an option that disappears before confirmation and a refusal where further information cannot be disclosed.
I would examine whether the consumer preserves the original objective, compares complete costs, separates suggestion from permission and can end with an honest pending decision. Wrong substitutions and the work required to reverse them matter too. A higher rate of “resolved” operations can coexist with more harmful choices.
If more automated consumers use these APIs between 2027 and 2030, I would make recovery paths an explicit part of the contract. The immediate decision is which conditions the system may vary independently, which require confirmation and which must remain fixed. Define those boundaries before designing the alternative list.
[+] On this page 15 topics ▼
- Start with the requirement the alternative no longer meets
- Explaining a refusal and proposing options are different jobs
- An option needs to expose the complete difference
- Knowing an alternative exists does not grant access to every field
- Observed availability can change before selection
- List order also communicates a recommendation
- Finding no options is not a universal conclusion
- Evaluate recovery through decisions that genuinely diverge
- Author
- Frequently Asked Questions
- Can an alternative returned by an API be executed automatically?
- Does the alternative list guarantee availability?
- Does an empty list mean no solution exists?
- Related Articles
- Continue reading
Frequently Asked Questions
Can an alternative returned by an API be executed automatically?
Only if it falls within the effective authorization and request conditions. Being listed as an alternative does not itself provide that authorization.
Does the alternative list guarantee availability?
No. It may describe an observation that changes before selection. Execution must recheck availability, permissions and relevant conditions.
Does an empty list mean no solution exists?
It may mean no options were found within the search criteria. The contract should distinguish that finding from incomplete search or an unavailable dependency.
Related
Start your project
Need a website that earns trust, ranks in search, and gives your business a stronger digital presence? Start the conversation here.