API Quickstart
Create and execute an action entirely from the command line.
1
Grab an API key
You'll need an API key from the dashboard (starts with sk_). All API calls below are authenticated with this key.
2
Create an action
Use the REST API to create a scoped proxy endpoint for a downstream API call.
POST
/api/v1/actions
curl -X POST https://narrowapi.com/api/v1/actions \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Send welcome email",
"method": "POST",
"target_url": "https://api.resend.com/emails",
"auth_type": "bearer",
"auth_value": "re_your_resend_key",
"input_schema": [
{"name": "to", "type": "string", "required": true},
{"name": "subject", "type": "string", "required": true},
{"name": "body", "type": "string", "required": true}
],
"body_template": "{\"from\":\"hi@example.com\",\"to\":\"{{to}}\",\"subject\":\"{{subject}}\",\"html\":\"{{body}}\"}"
}'
3
Create a scoped token
A token grants access to specific actions only. This token can call the email action but nothing else.
POST
/api/v1/tokens
curl -X POST https://narrowapi.com/api/v1/tokens \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "email-agent-token",
"action_ids": ["act_7kX2m9"]
}'
{"token":"sxt_Dk9m2x..."} 201 Created
Important: The full token is only shown once. Copy it now and give it to your agent.
4
Execute from your agent
Your agent calls the proxy endpoint with the scoped token and only the fields defined in the input schema.
POST
/x/act_7kX2m9
curl -X POST https://narrowapi.com/x/act_7kX2m9 \
-H "Authorization: Bearer sxt_Dk9m2x..." \
-H "Content-Type: application/json" \
-d '{
"to": "user@example.com",
"subject": "Welcome!",
"body": "<h1>Welcome aboard</h1>"
}'
{"id":"msg_abc123"} 200 OK (proxied from Resend)