Request approval for an OAuth tool intent
Creates one immutable batch of up to 20 tool calls for one intent.
POST
Creates one immutable batch of up to 20 tool calls for one intent. Only an OAuth access token may create a request. The owner opens approvalUrl and decides in a signed-in owner session. Requests expire after 30 minutes; the original OAuth token must remain valid. Repeating idempotencyKey for the same caller returns the same request; different content conflicts. Credential-bearing arguments are refused.
apiKeyheader
x-api-key<token>application/json- body
intent*stringLength
1 <= length <= 500calls*array<>Items
1 <= items <= 20idempotencyKey*stringLength
1 <= length <= 128ApprovalRequest
application/json- response
id*ApprovalRequestIdMatch
^apr_[0-9a-hjkmnp-tv-z]{16,24}$organizationId*OrganizationIdMatch
^org_[0-9a-hjkmnp-tv-z]{16,24}$namespaceId*|nullclientId*stringrequestedBy*UserIdMatch
^user_[0-9a-hjkmnp-tv-z]{16,24}$intent*stringcalls*array<>Items
1 <= items <= 20status*stringValue in
"pending""executing""executed""rejected""failed""expired"expiresAt*stringcreatedAt*stringdecidedAt*string|nulldecidedBy*|nullreason*string|nullresults*array<any>|nullerror*string|nullapprovalUrl*stringimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.approvalRequests.create({
"intent": "example",
"calls": [
{
"toolName": "example",
"arguments": {}
}
],
"idempotencyKey": "example"
});Example Response
{
"id": "string",
"organizationId": "string",
"namespaceId": "string",
"clientId": "string",
"requestedBy": "string",
"intent": "string",
"calls": [
{
"toolName": "string",
"arguments": {
"property1": "string",
"property2": "string"
}
}
],
"status": "pending",
"expiresAt": "string",
"createdAt": "string",
"decidedAt": "string",
"decidedBy": "string",
"reason": "string",
"results": [],
"error": "string",
"approvalUrl": "string"
}