Guides

Giving a key to an AI tool or an agent

One key per tool, a cap sized to the job, an allowlist for a fixed address, revoke when done.

An AI tool, an agent or a script that sends mail for you is a program holding a password. It does not get tired, it does not notice when something has gone wrong, and if the key it holds leaks, whoever has it can send as your domain until you notice. Four habits keep that small.

One key per tool

Give each tool its own SMTP key, named for the tool. Never hand two tools the same key, and never hand a tool a person's mailbox password.

When one tool misbehaves or is retired, you revoke its key and nothing else stops. When tools share a key, you cannot tell which one sent what, and revoking it takes the others down with it.

curl -X POST "$MAILYTE_BASE/api/v1/smtp-credentials" \
  -H "Authorization: Bearer $MAILYTE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"domain_id": "01JBT8XQ2M9WYC3K4F6R7S8T9V", "name": "support-agent", "daily_limit": 200}'

In the dashboard it is Sending → SMTP credentials → Create Credential.

A cap sized to the job

Every key has a daily cap, counted in recipient addresses: one message to fifty people spends fifty. A new key starts at 1,000 addresses a day. Set it to what the tool actually needs, not more.

A support agent that answers forty tickets a day needs a cap of about a hundred, not a thousand. The cap is what limits the damage if the key leaks: a stolen key capped at 100 addresses a day can do very little before the day is over, whatever the thief intends.

Sending past the cap is delayed, not lost — the tool is told to try again later. If the tool's real workload grows, raise the cap; that is one edit, and the key does not change.

An allowlist if the tool has a fixed address

If the tool runs on a server with a fixed IP address, add that address to the key's allowlist. From then on the key only works from that address: anyone else holding it is locked out, even with the right password.

A tool running on someone's laptop, or on a service whose addresses change, cannot use this. That is fine — the cap still holds. Do not guess at an address range; a wrong one locks the tool itself out.

In the dashboard: open the key, choose Edit, and turn on "Restrict to specific IP addresses". Over the API it is PUT /api/v1/smtp-credentials/{id}/ip-allowlist.

Revoke when the job is done

A key nobody needs is only a liability. When the tool is retired, or the task it was given is finished, revoke its key the same day. Revoking is reversible with one click if you were wrong; a leak from a key you had forgotten about is not.

If the job has a known end, set an expiry when you create the key. It stops working at that moment on its own, whether or not you remember.

Next

SMTP or the API — which of the two the tool should be using in the first place.