Three Ways to Get a Code

Email and phone rentals are lent by Phones Inc, one service at a time. 2FA entries are secrets you store yourself.
Email and phone rentals must be enabled for your organization by Phones Inc. Until then Rent answers forbidden. Contact support to enable them. 2FA entries need no setup.

By Email

  1. Find the service’s id with List Services. email.available says how many addresses can be rented right now.
  2. Rent an address with type: "email".
  3. Enter the rental’s address in the service’s sign-up or login form.
  4. Call Get Rental every few seconds until code is set.
The address has never received mail from that service. The rental lasts 15 minutes; if no code arrives by then its status becomes expired.

By SMS

The same steps with type: "phone". The address is a phone number in international format, such as +15550100123. Check phone.available in List Services first. A phone rental lasts until its expiresAt, usually a few minutes.
Cancel a rental you no longer need. A rented address or number is yours only while the rental lasts, so do not use it for later logins. List Rentals shows your active rentals and those from the last 24 hours.

With 2FA

For an account protected by an authenticator app, store the account’s 2FA secret once and ask for the current code whenever the service asks for it.
  1. In the service’s two-factor settings, choose an authenticator app and copy the setup key (the text version of the QR code).
  2. Add it with POST /v1/authenticator/add. app is tiktok or instagram; label is your name for the account, such as its username; phone optionally links the entry to one of your phones.
  3. Read the current code with POST /v1/authenticator/code and the entry’s id. Each code is valid until its expiresAt, about 30 seconds.
When the setup screen is open on one of your phones, POST /v1/authenticator/scan does steps 1 and 2 for you: it reads the QR code off the phone’s screen and stores the entry for that phone, without the setup key ever reaching your code. See Scan 2FA QR Code.
The secret is never returned. List your entries with POST /v1/authenticator (pass phone to list one phone’s entries), change label, app or phone with POST /v1/authenticator/update, and remove one with POST /v1/authenticator/delete. See List 2FA Entries, Add 2FA Entry and Get 2FA Code.
Anyone with a 2FA secret and the account’s password can log in. Keep secrets out of logs and version control.