Skip to main content

Sharing Secrets

1Claw supports sharing individual secrets with other users, agents, or external collaborators via email. Shares are time-limited, access-counted, and can be revoked at any time.

Try it out

Try out the example in this repo: Basic (includes sharing scripts).

Share types​

recipient_typeDescription
creatorShare back with the human who registered this agent (agents only, no ID needed)
userDirect share to an existing 1Claw user by ID
agentDirect share to a registered agent by ID
external_emailInvite-by-email — the recipient doesn't need an account yet (humans only)
anyone_with_linkAnyone with the share URL can access (see warning below)
anyone_with_link is a bearer secret

GET /v1/share/{share_id} is unauthenticated. For anyone_with_link shares, anyone who has the URL receives the decrypted secret value in the JSON response — the link itself is the credential (like an unlisted API key).

Strongly recommended for this share type:

  • Set a passphrase — recipients must send it in the JSON body on each access: {"passphrase":"..."}.
  • Set an ip_allowlist — restrict access to known egress IPs.
  • Keep expires_at and max_access_count as tight as your workflow allows.
  • Treat share URLs like passwords: never post them in chat, tickets, or public repos; revoke immediately if leaked.

Other recipient types (user, agent, creator, external_email) still require authentication or the inbound accept flow — only anyone_with_link exposes plaintext to unauthenticated GET.

Create a share​

curl -X POST https://api.1claw.co/v1/secrets/{secret_id}/share \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"recipient_type": "external_email",
"email": "colleague@example.com",
"expires_at": "2026-03-15T00:00:00Z",
"max_access_count": 5
}'

Response:

{
"id": "uuid",
"share_url": "https://api.1claw.co/v1/share/uuid",
"recipient_type": "external_email",
"recipient_email": "colleague@example.com",
"expires_at": "2026-03-15T00:00:00Z",
"max_access_count": 5
}

Agent-to-human sharing (creator)​

The simplest way for an agent to share a secret back with the human who owns it:

curl -X POST https://api.1claw.co/v1/secrets/{secret_id}/share \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"recipient_type": "creator",
"expires_at": "2026-03-15T00:00:00Z",
"max_access_count": 5
}'

The backend resolves the agent's created_by field to identify the human. No user UUID or email needed. The human sees the share in their Inbound shares and accepts it.

Via MCP:

share_secret(secret_id: "...", recipient_type: "creator", expires_at: "2026-12-31T00:00:00Z")

Shares created by agents​

An agent can create a share for any secret it can read (the same vault binding, scope and read policy checks as reading the secret). A share an agent creates expires within 30 days and opens at most 100 times: a longer expires_at or larger max_access_count, or none, is clamped to those limits, and the response shows the values applied. Agents may use anyone_with_link, user, agent and creator; external_email is refused with 403 for agents.

A link an agent hands to a person or another tool:

curl -X POST https://api.1claw.co/v1/secrets/{secret_id}/share \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"recipient_type": "anyone_with_link",
"expires_at": "2026-10-23T00:00:00Z",
"max_access_count": 1,
"passphrase": "correct-horse-battery"
}'

A direct share to another agent in the same org:

const { data: share } = await client.sharing.create(secretId, {
recipient_type: "agent",
recipient_id: otherAgentId,
expires_at: "2026-10-23T00:00:00Z",
max_access_count: 3,
});

What to expect:

  • creator is resolved to a user share for the human who created the agent, so the response's recipient_type is user.
  • user and agent recipients must be in the agent's org.
  • When someone opens a share an agent created, the access notification goes to the human who created that agent.
  • The agent can revoke its own shares with DELETE /v1/share/{share_id}, and an org owner or admin can revoke any of them.
  • Deleting the agent, or a critical risk verdict that revokes it, deletes every share it created.
  • Agent-created shares count toward the org's share limits (10 per minute, and the plan's monthly share allowance), counted by the secret's org.

Before 2026-10-22, every share an agent created failed with 500. That is fixed.

Invite-by-email flow​

When a human shares with recipient_type: "external_email":

  1. A share record is created with the recipient's email.
  2. The recipient receives an email notification with a link to sign in.
  3. When the recipient signs up or logs in with that email, all pending shares are automatically claimed — they appear in the recipient's account.
  4. The recipient can then access the shared secret through the API or dashboard.

Note: only humans can create email-based shares — agents are blocked from this type to prevent email spam.

Access a share​

For anyone_with_link shares, GET /v1/share/{share_id} requires no Authorization header and returns the decrypted secret to anyone holding the URL. Prefer passphrase + IP allowlist (see warning above).

curl https://api.1claw.co/v1/share/{share_id}
# If the share has a passphrase, send it as a JSON body on the same GET:
# curl -X GET -H "Content-Type: application/json" \
# --data '{"passphrase":"your-passphrase"}' https://api.1claw.co/v1/share/{share_id}

Returns the decrypted secret value if the share is still valid (not expired, under access limit).

Revoke a share​

The share's creator, or an owner or admin of the org that owns the secret, can revoke it:

curl -X DELETE https://api.1claw.co/v1/share/{share_id} \
-H "Authorization: Bearer $TOKEN"

List every share in your org​

Org owners and admins can list the shares on the org's secrets, including ones agents created:

curl https://api.1claw.co/v1/shares/org?created_by_type=agent \
-H "Authorization: Bearer $TOKEN"

Each item carries created_by and created_by_type (user or agent). Omit created_by_type to list all of them.

Email notifications​

When a share is created with external_email, the recipient receives an email. The share creator also receives a notification each time the shared secret is accessed.

See Email Notifications for the full list of automated emails.

Agent fleet sharing patterns​

When you have many agents sharing secrets with their humans, the creator pattern scales naturally:

  • Each agent uses recipient_type: "creator" — no need to track user IDs or emails.
  • The human sees all agent shares in their Inbound tab, grouped by agent.
  • Share creation is rate-limited to 10/minute per org, so agents should avoid creating shares in tight loops.

Tip: For agents that generate credentials frequently (e.g. rotating tokens), update the same secret path rather than creating new shares for each rotation. The human's existing share remains valid as long as the secret exists.

// Agent updates the secret in-place (new version)
await client.secrets.set(VAULT_ID, "credentials/session-token", newToken, {
type: "api_key",
});
// No new share needed — the existing share points to the latest version

For bulk operations across many agents, see Managing Agent Fleets.

Security considerations​

  • Same checks as a read: creating a share runs the checks reading the secret runs. Secrets in system vaults (__*), private_key and ssh_key secrets of an agent with intents enabled, and callers whose delegation scope lacks secrets:read are refused; a vault that requires a passkey needs X-Auth-Confirm; sharing a honeytoken fires its alert.
  • anyone_with_link bearer risk: Unauthenticated GET /v1/share/{id} returns plaintext. Use passphrase + IP allowlist; rotate/revoke on leak.
  • Shares respect the max_access_count — once exhausted, the link is dead.
  • Shares expire at expires_at — past that datetime, access is denied.
  • Share creators are notified on each access.
  • Revoked shares return 404 immediately.
  • Optional: add a passphrase or ip_allowlist to the share for additional protection.