Skip to content

Templates · Published 2026-09-28 · AgentiSend team

Sign-in code

Send a one-time code a person types to sign in to your product.

Send a one-time code a person types to sign in to your product.

Variables

Every placeholder is required. A send that omits one is refused with that name, rather than going out with a blank.

  • product_name (string, required). Your product, as the person knows it.
  • sign_in_code (string, required). The code. Pass it as a string so a leading zero survives.
  • expires_minutes (number, required). How long the code stays valid, in minutes.

Rendered with the example values

These values are samples. They are not an account on AgentiSend.

Subject: Your Acme sign-in code

<p>Your sign-in code for Acme is:</p>
<p><strong>482913</strong></p>
<p>It works once and expires in 10 minutes.</p>
<p>If you did not ask for this code, you can ignore this email.</p>
Your sign-in code for Acme is:

482913

It works once and expires in 10 minutes.

If you did not ask for this code, you can ignore this email.

Create the draft

POST /templates and the create_template tool take this body. The draft does not send until it is published.

{
  "name": "Sign-in code",
  "subject": "Your {{product_name}} sign-in code",
  "content": {
    "mode": "markdown",
    "source": "Your sign-in code for {{product_name}} is:\n\n**{{sign_in_code}}**\n\nIt works once and expires in {{expires_minutes}} minutes.\n\nIf you did not ask for this code, you can ignore this email."
  },
  "variables": [
    {
      "name": "product_name",
      "type": "string",
      "required": true
    },
    {
      "name": "sign_in_code",
      "type": "string",
      "required": true
    },
    {
      "name": "expires_minutes",
      "type": "number",
      "required": true
    }
  ]
}

Publish it

Call publish_template with the id POST /templates returned. Publishing again makes the next version. A version that already went out does not change.

{
  "name": "publish_template",
  "arguments": {
    "template_id": "<the id POST /templates returned>"
  }
}

Send it

Create the draft with the body above, publish it, then send with template_id and template_values. The rules are in Templates. The three calls, including a render that does not send, are in How do I send an email from a template. The next starter is Password reset.