Use case
Approval workflows and guardrails for AI-generated social posts
Set requireApproval on an agent's API key and every post it creates lands in a pending_approval state. The agent can submit drafts, but only a human with approval rights can approve and publish them. You can also cap the key with a daily post limit and a monthly X spend cap. The API enforces all of it, so MCP, the CLI and the SDK inherit the same rules automatically.
cURL (REST)Set guardrails with the SDKMCP prompt
How it works
- 1
Create a dedicated key
One key per agent or workflow, so limits and attribution stay clean. Every post records which key created it. - 2
Turn on guardrails
Set dailyPostLimit, monthlyXSpendCentsCap and requireApproval in the dashboard key editor or through workspaces.updateApiKey. - 3
The agent submits, a human decides
Drafts go through POST /api/content/:id/submit-for-approval. A reviewer calls approve or reject, or does it in the dashboard. - 4
Past a cap, the API says no
Limit breaches return a 403 with the reason, which agents can relay to the user instead of retrying blindly.
Working code
# 1. Agent saves a draft
curl -X POST https://api.socifyr.com/api/content/text \
-H "Authorization: Bearer sk_your_key" \
-H "X-Workspace-Id: your_workspace_id" \
-H "Content-Type: application/json" \
-d '{ "connections": ["linkedin-mybrand"], "text": "Proposed post", "saveDraft": true }'
# 2. Agent submits it for review
curl -X POST https://api.socifyr.com/api/content/<id>/submit-for-approval \
-H "Authorization: Bearer sk_your_key" \
-H "X-Workspace-Id: your_workspace_id" \
-H "Content-Type: application/json"
# 3. A human (not the guarded key) approves
curl -X POST https://api.socifyr.com/api/content/<id>/approve \
-H "Authorization: Bearer <human session token>" \
-H "X-Workspace-Id: your_workspace_id"import { Socifyr } from '@socifyr/sdk'
const socifyr = new Socifyr({
apiKey: process.env.SOCIFYR_API_KEY!,
workspaceId: process.env.SOCIFYR_WORKSPACE_ID!,
})
// Run with an owner/admin key: add guardrails to the agent's key
await socifyr.workspaces.updateApiKey(workspaceId, agentKeyId, {
dailyPostLimit: 5,
monthlyXSpendCentsCap: 500,
requireApproval: true,
})Draft three LinkedIn posts about this week's release and submit them
for approval. Do not try to publish them directly.Replace sk_your_key and the workspace ID with your own from the dashboard, and use your own connection slugs.
Who this is for
Brands that cannot afford a bad post
Let an agent write and queue, and keep a person on the publish button.Teams with compliance or legal review
Keep an auditable gap between generation and publication.Anyone cautious about spend
X bills per post, so a monthly cap on a key keeps an overeager agent from running up a bill.
Frequently asked questions
Can the agent approve its own posts?
No. A key with requireApproval gets a 403 on approve, reject, publish and publish-now. It can only create and submit for approval.
Do guardrails work with MCP and the CLI?
Yes. Both post through the REST API using the key, so the key's limits apply with no extra setup.
Can an agent raise its own limits?
No. A guarded key cannot create, update or delete API keys. Everything outside a short reviewed list of posting routes is closed to it by default.
Do scheduled backlogs bypass the daily limit?
No. The daily allowance is reserved when a post leaves draft, so drafts, bulk rows and parallel requests all count, and deleting a post does not refund it.
Is the X spend cap an exact bill?
It is a reserved estimate per key, so failed X posts still count toward it. Treat it as a safety ceiling, not an invoice.