Skip to content

Approve or reject a request

POST
/api/v1/requests/{id}/decision
curl --request POST \
--url http://localhost:11044/api/v1/requests/example/decision \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "decision": "example", "reason": "example" }'

Approving calls the request’s verb as you, through the gateway. Rejecting needs a reason.

id
required
string

The request’s id

The decision on a pending request: decision is approve or reject, case-insensitive, and anything else is a 409. Approving runs the request’s verb as the caller and ignores reason; rejecting requires a non-blank reason, which is recorded on the request and in the run ledger

Media typeapplication/json

The owner’s decision on an agent’s request, the body of POST /requests/{id}/decision.

object
decision
required

approve or reject, case-insensitive. Approving calls the request’s verb as the caller.

string
reason

Why the request is rejected, recorded on it and in the run ledger. Required, and not blank, for reject; ignored for approve.

string

Example generated

{
"decision": "example",
"reason": "example"
}

The request after the decision

Media typeapplication/json

The outcome of a decision: the request as it now stands (200), or why the decision was refused (409).

object
refused

Why the decision was refused: already decided or expired, a rejection with no reason, or a decision other than approve/reject. Null when it was applied.

string
request

The request after the decision — APPROVED, REJECTED, or FAILED when the approved verb call failed. Null when the decision was refused.

object
about

Whom or what the call is about, by name (e.g. the customer a note goes on); null when the call did not say

string
agent

Agent whose run raised it, shown to the approver as who is asking; null when no agent holds the routine or a person asked

string
args
required

The verb’s input, as a JSON-encoded string

string
decidedAt

When it was approved or rejected, or for an expired one its expiresAt, as an ISO-8601 instant; null while pending

string format: date-time
decidedBy

Username of the person who approved or rejected it; null while pending and for an expired request

string
detail
required

What would happen and why, in the business’s words; what the approver reads first

string
evidence
required

Rows the routine read that made it ask, as it saw them when it asked; at most 50, empty when it gave none

Array<object>
object
key
additional properties
expiresAt
required

When an unanswered request expires, as an ISO-8601 instant; three days after raisedAt

string format: date-time
id
required

Identifier of the request, req_ followed by a UUID; the {id} in /requests/{id}

string
ownerId
required

User id of the person in whose world the request was raised, and who decides it

string
quote

Text the call would write where people read it (a note, a message), as it would land; null when the call writes none or did not say

string
raisedAt
required

When it was raised, as an ISO-8601 instant

string format: date-time
raisedBy

User id of the person whose own call, made outside any routine run, was held for approval; null when a routine or an agent asked

string
raisedByName

Display name of raisedBy at the time they asked; null when raisedBy is null

string
reason

Why it was rejected, as the rejecter wrote it; null unless status is REJECTED

string
result

What the verb answered once approved, or its error when status is FAILED, truncated to 2000 characters; null until approved

string
routine
required

Name of the routine that raised it; (unnamed routine) when no routine did, as for a person’s own held call

string
runId

Id of the routine run it was raised in; null when it was raised outside any run

string
secondPersonAsked
required

True when the verb’s publisher asks for an approver other than the caller. Advisory: the world does not enforce it

boolean
selfApproved
required

True when it was approved by the same person who raised it (raisedBy); allowed, and recorded so

boolean
status
required

PENDING until decided; then APPROVED (the verb succeeded), FAILED (approved, but the verb answered an error), REJECTED, or EXPIRED (nobody answered before expiresAt)

string
Allowed values: PENDING APPROVED FAILED REJECTED EXPIRED
untrusted
required

Text from outside the business the routine read before asking, each as source: what, sorted; the draft came after it. Empty when it read none

Array<string>
verb
required

Gateway tool to call on approval, e.g. odoo_partnerMessagePost

string

Example

{
"request": {
"status": "PENDING"
}
}

No authenticated principal

One of:

A refusal with a machine-readable code and a plain-language message. ApiErrorAdvice answers it for a failed validation, a missing resource or a conflicting state, and some controllers answer it directly

object
code
required

Machine-readable key to branch on, such as validation_failed, unknown_field, not_found or conflict. Open: a surface may answer codes of its own

string
detail

Extra context where there is some, such as the fields a body may carry; null otherwise

string
message
required

A plain-language explanation, written to be shown. Never carries an exception message

string

Example generated

{
"code": "example",
"detail": "example",
"message": "example"
}

No such request in your world

Refused: already decided or expired, a rejection with no reason, or no such decision

Media typeapplication/json

The outcome of a decision: the request as it now stands (200), or why the decision was refused (409).

object
refused

Why the decision was refused: already decided or expired, a rejection with no reason, or a decision other than approve/reject. Null when it was applied.

string
request

The request after the decision — APPROVED, REJECTED, or FAILED when the approved verb call failed. Null when the decision was refused.

object
about

Whom or what the call is about, by name (e.g. the customer a note goes on); null when the call did not say

string
agent

Agent whose run raised it, shown to the approver as who is asking; null when no agent holds the routine or a person asked

string
args
required

The verb’s input, as a JSON-encoded string

string
decidedAt

When it was approved or rejected, or for an expired one its expiresAt, as an ISO-8601 instant; null while pending

string format: date-time
decidedBy

Username of the person who approved or rejected it; null while pending and for an expired request

string
detail
required

What would happen and why, in the business’s words; what the approver reads first

string
evidence
required

Rows the routine read that made it ask, as it saw them when it asked; at most 50, empty when it gave none

Array<object>
object
key
additional properties
expiresAt
required

When an unanswered request expires, as an ISO-8601 instant; three days after raisedAt

string format: date-time
id
required

Identifier of the request, req_ followed by a UUID; the {id} in /requests/{id}

string
ownerId
required

User id of the person in whose world the request was raised, and who decides it

string
quote

Text the call would write where people read it (a note, a message), as it would land; null when the call writes none or did not say

string
raisedAt
required

When it was raised, as an ISO-8601 instant

string format: date-time
raisedBy

User id of the person whose own call, made outside any routine run, was held for approval; null when a routine or an agent asked

string
raisedByName

Display name of raisedBy at the time they asked; null when raisedBy is null

string
reason

Why it was rejected, as the rejecter wrote it; null unless status is REJECTED

string
result

What the verb answered once approved, or its error when status is FAILED, truncated to 2000 characters; null until approved

string
routine
required

Name of the routine that raised it; (unnamed routine) when no routine did, as for a person’s own held call

string
runId

Id of the routine run it was raised in; null when it was raised outside any run

string
secondPersonAsked
required

True when the verb’s publisher asks for an approver other than the caller. Advisory: the world does not enforce it

boolean
selfApproved
required

True when it was approved by the same person who raised it (raisedBy); allowed, and recorded so

boolean
status
required

PENDING until decided; then APPROVED (the verb succeeded), FAILED (approved, but the verb answered an error), REJECTED, or EXPIRED (nobody answered before expiresAt)

string
Allowed values: PENDING APPROVED FAILED REJECTED EXPIRED
untrusted
required

Text from outside the business the routine read before asking, each as source: what, sorted; the draft came after it. Empty when it read none

Array<string>
verb
required

Gateway tool to call on approval, e.g. odoo_partnerMessagePost

string

Example

{
"request": {
"status": "PENDING"
}
}