Reject Request
The terminal node that ends an execution as rejected, with an error code and a message its author chose.
2 min read
Reject Request ends a path with a refusal the flow's author designed. The execution that reaches it is rejected, and the caller gets the code and the message the node is set to give.
- Node
- Reject Request
- Type
reject- Category
- Output
- Ports
- None
- Ends the path
- Yes
What it does
The node ends the execution as rejected. The execution carries the code of the node as error_code and its message as error_message; its output is null. Nothing runs after it.
{
"status": "rejected",
"output": null,
"error_code": "plan_required",
"error_message": "This operation needs the Pro plan"
}The refusal is an answer, not an error of the request: the SDKs return the execution and raise nothing, and the caller tells it from a completed one by the status — Send a request.
When to use it
Refuse a request a Condition decided against: a plan, a size, a missing field.
Answer a refused spend in your own words: lead the Deny branch of Budget Check or AI Model here.
A node answers for one reason. When a flow refuses for several, give each its own node with its own code, so that the caller can tell them apart.
Settings
| Setting | What it is for |
|---|---|
error_code | The code the execution ends with — 1 to 64 lowercase Latin letters, digits, dots and underscores. Required. |
message | The sentence for a person that goes with the code, at most 500 characters. Empty or absent, the execution carries the sentence The request was rejected by the flow. |
In the builder the settings are Error code and Message. A new node is set to the code below; a node without a message answers «The request was rejected by the flow».
{ "error_code": "rejected_by_flow" }Ports
The node has no ports: it ends the path. Ports and branching says why every path ends at a terminal node.
Output
The node leaves no answer: the output of a rejected execution is null. The code and the message are what the caller reads, and the trace has them in its rejected event.
Errors
The node raises no error. The settings are checked when the flow is validated and when it is published.
In the API an entry of issues names such a check in params.detail; its code is invalid_node_config.
| Check | Message in the builder |
|---|---|
reject_needs_error_code | “{node}” needs an error code. |
reject_invalid_error_code | The error code of “{node}” must be 1 to {max} characters: lowercase Latin letters, digits, dots and underscores. |
reject_invalid_message | The message of “{node}” must be text of at most {max} characters. |
Example
- Request — Default → Condition
- Condition — Met → AI Model
- Condition — Not met → Reject Request
- AI Model — Success → Return Response
Condition tests the plan of the customer. A request without the plan ends at Reject Request with plan_required, and no model is called for it.
Related
Send a request — a refusal of the flow and a refusal of the platform, from the side of the application.
Return Response — the other way a path ends.
Ports and branching — the terminal nodes and the ports of the others.
Built from openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d