Skip to main content
Python
import requests

url = 'https://api.simplex.sh/add_2fa_config'
headers = {
    'X-API-Key': 'your_api_key_here'
}
data = {
    'seed': 'your_2fa_seed',  # Required: The 2FA seed/secret
    'name': 'GitHub',  # Optional: Name for the config
    'partial_url': 'github.com'  # Optional: URL pattern to match
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
if result['succeeded']:
    print(f"2FA config added successfully")
    print(f"Total configs: {result['total_configs']}")
else:
    print(f"Error: {result['error']}")
{
  "succeeded": true,
  "added_config": {
    "type": "<string>",
    "two_fa_seed": "<string>",
    "name": "<string>",
    "partial_url": "<string>"
  },
  "total_configs": 123,
  "all_configs": [
    {}
  ],
  "error": "<string>"
}
Programmatically creating 2FA configs is currently only supported for TOTP seeds. Contact us on Slack if you need programmatic support for email/SMS as well.

Use Cases

  • Automated Login: Configure 2FA seeds for services your workflows need to access automatically
  • Site-Specific Authentication: Match configurations to specific URLs for targeted authentication
  • Multi-Service Support: Store multiple 2FA configurations for different services

Configuration Details

Each 2FA configuration can include:
  • Seed: The TOTP secret/seed for generating 2FA codes (required)
  • Name: A friendly name to identify the configuration (optional)
  • Partial URL: URL pattern to automatically match and apply the configuration (optional)
Either name or partial_url must be provided along with the required seed.

Response

The API returns:
  • The added configuration details
  • Total number of configurations for your organization
  • Array of all existing configurations

Security Notes

  • 2FA seeds are stored securely and associated with your organization
  • Configurations are only accessible via authenticated API requests
  • Seeds are used to generate TOTP codes during automated browser sessions

Authorizations

X-API-Key
string
header
required

Simplex API Key

Body

application/json
seed
string
required

The 2FA seed/secret for generating TOTP codes.

name
string

Optional name for the 2FA configuration.

partial_url
string

Optional partial URL to match for automatic 2FA code entry.

Response

2FA configuration added successfully

succeeded
boolean
required

Whether the operation succeeded.

added_config
object

The 2FA configuration that was added.

total_configs
integer

Total number of 2FA configs for this organization.

all_configs
object[]

Array of all 2FA configurations.

error
string

Error message if the operation failed.

I