HTML version: https://cooperemail.com/guides/let-your-agent-pass-2fa-sign-ups

- [Home](/)
- › [Guides](/guides)
- › Let your agent pass 2FA sign-ups

Guide

# Let your agent pass 2FA sign-ups

Email codes still arrive with [wait-for-code](/guides/ai-agent-receive-otp-verification-code-email). An authenticator app is a seed the agent has to keep. Store that seed on the same inbox.

Create the inbox, use that address on the sign-up form, and wait for the confirmation mail. When the site shows a QR code or a base32 seed, POST it to `/api/v1/inboxes/{id}/credentials` with `type` `totp`. The create response does not echo the seed. When the form asks for the 6-digit code, POST `.../credentials/{cid}/retrieve`. `code` is the current code. `expires_in` is how many seconds are left in that period.

The same inbox can store a `secret` or a `password` (origin, username, and password). List and get show the label and, for a password, the origin and username. They do not show the secret. Retrieve is the call that returns it, and it writes `credential.retrieved` without the secret. MCP: `cooper_create_credential`, `cooper_get_totp_code`, `cooper_retrieve_credential`.

A scoped key needs `credentials:write` to store or delete and `credentials:read` to list or retrieve. A full-access key can do both. These routes return HTTP 503 `vault_unavailable` when `COOPER_VAULT_KEY` is unset. Other Cooper routes keep working. Reference: [/docs/credentials](/docs/credentials).

```
AUTH=(-H "Authorization: Bearer ${COOPER_API_KEY}")

# The inbox already exists. Save the seed from the authenticator QR as base32.
curl -s -X POST https://cooperemail.com/api/v1/inboxes/$INBOX/credentials \
  "${AUTH[@]}" -H 'content-type: application/json' \
  -d '{"type":"totp","label":"Example","otpauth_uri":"otpauth://totp/Example:agent?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30"}'
# {"object":"credential","id":"cred_…","type":"totp","label":"Example","digits":6,"period":30,"algorithm":"SHA1",…}

# When the form asks for the authenticator code:
curl -s -X POST https://cooperemail.com/api/v1/inboxes/$INBOX/credentials/$CRED/retrieve \
  "${AUTH[@]}"
# {"object":"credential_secret","id":"cred_…","type":"totp","code":"123456","expires_in":17,"digits":6,"period":30,"algorithm":"SHA1"}
```

Operator: Avatar 8 LLC (ops@avatar33.com).
