Skip to Content

Approve and execute an OAuth tool intent

Only an organization owner in a signed-in session may approve.

POST
/v1/approval-requests/{id}/approve

Only an organization owner in a signed-in session may approve. Claims a pending, unexpired request once, then executes its exact calls with the original OAuth authority. Repeating a decision returns the existing receipt. Execution is never retried automatically; a failed receipt can mean some actions completed, and must be reconciled before another request is created.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^apr_[0-9a-hjkmnp-tv-z]{16,24}$

Response Body

ApprovalRequest

application/json
  1. response
id*ApprovalRequestId
Match^apr_[0-9a-hjkmnp-tv-z]{16,24}$
organizationId*OrganizationId
Match^org_[0-9a-hjkmnp-tv-z]{16,24}$
namespaceId*|null
clientId*string
requestedBy*UserId
Match^user_[0-9a-hjkmnp-tv-z]{16,24}$
intent*string
calls*array<>
Items1 <= items <= 20
status*string
Value in"pending""executing""executed""rejected""failed""expired"
expiresAt*string
createdAt*string
decidedAt*string|null
decidedBy*|null
reason*string|null
results*array<any>|null
error*string|null
approvalUrl*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.approvalRequests.approve({
  "id": "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"
}

Related documentation