Wait for 2FA code step

What to use the Wait for 2FA code step for


Some sites send a short verification code to your phone or email during login, rather than using an authenticator app. The Wait for 2FA code step pauses the automation at that point and waits for the code to be delivered through the axiom.ai API. Once the code arrives, it becomes the [two-factor-code] token, which you type into the verification field with an Enter text step.

You are responsible for getting the code (from your phone or inbox) and sending it to the waiting automation with a single API request. This makes it possible to clear an SMS or email code during an otherwise hands-off run.

If the site uses an authenticator app (a 6-digit code from an app like Google Authenticator or 1Password), use the Generate authenticator code step instead, which needs no API call at all.

Before you start:

  • This step runs in the cloud only, because the code is delivered by an API request. It does not run on the desktop app.
  • The delivery request requires a Pro plan or higher.
  • You'll need your API key and a tool to send a web request, such as Postman or curl.

How to configure the Wait for 2FA code step


Timeout

How long, in seconds, the automation waits for the code before giving up. Leave it empty to use the default of 120 seconds (2 minutes). If no code arrives in time, the run stops and fails with a clear message: "Timed out waiting for the verification code."

The step outputs the delivered code as the [two-factor-code] token. Add an Enter text step after it, select the verification field, and insert the [two-factor-code] token.

Deliver the code with the API


While the automation is waiting (and within the timeout window), send the code to the provide-2fa-code endpoint. The code goes to the run that has been waiting the longest.

Using curl:

curl -X POST https://lar.axiom.ai/api/v5/provide-2fa-code \
  -H "Content-Type: application/json" \
  -d '{"key":"your-api-key-here","code":"123456"}'

You can also pass the key in the X-API-KEY header instead of the body. On success you get:

{ "status": "ok", "message": "2FA code delivered." }

The automation continues immediately, types the code into the verification field, and finishes.

Error responses

SituationMessageStatus
No automation is currently waitingNo automation is currently awaiting a 2FA code.404
The code field is missingYou must send the 2FA code.400
The API key is wrong or emptyAuthentication error401
The account is not on a Pro plan or higherYou must have a pro subscription or higher to use this API.403

Note: the code is treated as text, so codes that start with a zero (for example 007123) keep the leading zero.

For a complete walkthrough of handling two-factor authentication, see Log in with 2FA.