Call an action
Validates `input` against the action's schema, runs it, validates the result against its output schema and returns it. Credentials come from `connections` (pack connection key to `conn_` ID), or else from your project's most recently created connection for that pack and key; when that connection belongs to an end user (it has a `subject`), the call is refused with `422 connection_required` instead, so an unnamed key never uses one end user's credential for another: name end-user connections explicitly. Using a stored connection, named or not, also needs `vault:run`. Only `pure` and `read` actions are retried automatically; send `Idempotency-Key` with `write` actions so a retry of your own does not repeat the effect (packs that declare an idempotency header pass it upstream). `timing` phases: `validate` (input schema), `inject` (connections), `render` (request templates), `upstream` (every HTTP exchange, retries and redirects included), `map` (response mapping and output schema) for declarative HTTP actions; `sidecar` for JavaScript actions. Bills one `actions.call` once the action ran.
/v1/actions/call
Authentication
Header Parameters
Idempotency-Key
string
optional
header
Request Body required
application/jsonref
string
REQUIRED
input
object
connections
object
timeout_ms
integer
Responses
application/jsonobject
string
REQUIRED
action_resultref
string
REQUIRED
output
unknown
REQUIRED
upstream_status
integer
timing
object
REQUIRED
total_ms
number
REQUIRED
curl -X POST 'https://beta-api.b3os.org/v1/actions/call' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "ref": "io.b3os/github/create-issue@1", "input": { "owner": "acme", "repo": "web", "title": "Checkout button misaligned on mobile" }, "connections": { "api": "conn_01m5t6cbgdjs1ketgcqwa2sne8" }}'
const response = await fetch('https://beta-api.b3os.org/v1/actions/call', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "ref": "io.b3os/github/create-issue@1", "input": { "owner": "acme", "repo": "web", "title": "Checkout button misaligned on mobile" }, "connections": { "api": "conn_01m5t6cbgdjs1ketgcqwa2sne8" } })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/actions/call', headers=headers, json={ "ref": "io.b3os/github/create-issue@1", "input": { "owner": "acme", "repo": "web", "title": "Checkout button misaligned on mobile" }, "connections": { "api": "conn_01m5t6cbgdjs1ketgcqwa2sne8" }})print(response.json())
{ "object": "action_result", "ref": "io.b3os/github/create-issue@1.2.0", "output": { "number": 1423, "url": "https://github.com/acme/web/issues/1423" }, "upstream_status": 201, "timing": { "validate_ms": 0.03, "inject_ms": 0.02, "upstream_ms": 412.6, "map_ms": 0.04, "total_ms": 412.8 }}
Try this endpoint
/v1/actions/call